Loading Oracle Drivers

Product: PowerShell Universal
Version:  5.0.13

I’m trying to use code to load oracle drivers and query a db. The code works in VS Code but crashes the server and have to restart it when running it.

try {
# Load Oracle Data Access assembly
import-Module “C:\ODP.NET_Managed121020\odp.net\managed\common\Oracle.ManagedDataAccess.dll”

$connectstring = "User ID=myid;Password=mypw;Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=myserverlocation)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=myservicename)))"

# Create and open the Oracle connection
$con = New-Object Oracle.ManagedDataAccess.Client.OracleConnection($connectstring)
$con.Open()

} catch {
Write-Output “Failed to connect: $_”
}

The server crashes at the $con.Open() line. Any insight would be appreciated.