Created
April 12, 2017 08:46
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .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