Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Anyone using Oracle.ManagedDataAccess.dll 23.9.1 with PowerShell?

David MartiSep 8 2025

Anyone find an easier way to load Oracle.ManagedDataAccess.dll 23.9.1 and use with Powershell 5.1? This is the best I could come up with thus far. I used Visual Studio 2022 to a create simple console app, and it figured out all dependencies for me. I'm not sure why the 19C era .DLL provided by OracleClientForMicrosoftTools_x64_19.exe works without the extra work on my part. I really do need the extra functionality from the 23.8+ era drivers for what I'm doing.

function Load-CustomAssemblies {
param (
[string]$DllDirectory = "G:\OracleSoftware\lib"
)

# System.Runtime.CompilerServices.Unsafe is a low-level .NET library that provides advanced memory manipulation  
#    capabilities—essentially giving developers access to operations that bypass the usual safety checks of the .NET runtime.  
#     It’s used heavily in performance-critical libraries like System.Text.Json, Span<T>, and Memory<T> to squeeze out every ounce of speed.  
  
# Microsoft.Bcl.AsyncInterfaces.dll is a support library that enables asynchronous programming features—especially for older .NET platforms that don’t natively support them.  
#    Eg. for older .NET Framework 4.6.2.  Used by libraries like System.Text.Json, Entity Framework Core, or Grpc.Net.Client  

$dlls = @(
"System.Runtime.CompilerServices.Unsafe.dll",
"Microsoft.Bcl.AsyncInterfaces.dll",
"System.Threading.Tasks.Extensions.dll",
"System.Buffers.dll",
"System.Memory.dll",
"System.ValueTuple.dll",
"System.Formats.Asn1.dll",
"System.Numerics.Vectors.dll",
"System.Diagnostics.DiagnosticSource.dll",
"System.Text.Encodings.Web.dll",
"System.Text.Json.dll",
"Oracle.ManagedDataAccess.dll"
)

foreach ($dll in $dlls) {
$fullPath = Join-Path $DllDirectory $dll
$dllName = [System.IO.Path]::GetFileNameWithoutExtension($dll)

   $alreadyLoaded = \[AppDomain\]::CurrentDomain.GetAssemblies() |  
       Where-Object { $\_.GetName().Name -eq $dllName }

   if ($alreadyLoaded) {  
       Write-Host "Skipped (already loaded): $dllName"  
   } elseif (Test-Path $fullPath) {  
       try {  
           \[System.Reflection.Assembly\]::LoadFrom($fullPath) | Out-Null  
           Write-Host "Loaded: $dllName"  
       } catch {  
           Write-Warning "Failed to load $($dllName): $($\_.Exception.Message)"  
       }  
   } else {  
       Write-Warning "DLL not found: $fullPath"  
   }  

}
}

This post has been answered by David Marti on Sep 9 2025
Jump to Answer
Comments
Post Details
Added on Sep 8 2025
7 comments
198 views