Skip to content

Instantly share code, notes, and snippets.

@piers7
Created April 12, 2017 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piers7/0f4641163d4fc6dff72134e0e0366a53 to your computer and use it in GitHub Desktop.
Save piers7/0f4641163d4fc6dff72134e0e0366a53 to your computer and use it in GitHub Desktop.
Tells you what the currently registered ODP.Net (native) assembly is for x64 and x32 Oracle .net drivers
# .synopsis
# Sees what Oracle .net driver is installed for x32 and x64
# .author
# Piers
param(
$providerName = 'Oracle.DataAccess.Client'
)
$job = {
$providerName = $args[0]
# Write-Host ('Test with bits={0}' -f [IntPtr]::Size) -ForegroundColor:Yellow
try{
$factory = [System.Data.Common.DbProviderFactories]::GetFactory($providerName)
new-object PSObject -Property:@{
Bits = [IntPtr]::Size * 8
AssemblyName = $factory.GetType().AssemblyQualifiedName
}
}catch{
new-object PSObject -Property:@{
Bits = [IntPtr]::Size * 8
AssemblyName = "Error: " + $_.Exception.Message
}
}
}
function RunJob([switch]$runAs32){
$jobInstance = Start-Job -ScriptBlock:$job -ArgumentList:$providerName -RunAs32:$runAs32;
$jobInstance | Wait-Job | Out-Null
$jobInstance | Receive-Job
}
RunJob -runAs32:$false
RunJob -runAs32:$true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment