Running 32-Bit-Code on 64-Bit Machines

by Nov 9, 2010

Some code may not work right on 64-Bit machines. Use this approach to make PowerShell execute code in an isolated 32-Bit PowerShell session and hand over its results to your 64-Bit PowerShell:

$32bitcode = {
[IntPtr]::Size
}
# run on 64bit machine directly
& $32bitcode
# run in isolated 32bit session
$job = Start-Job $32bitcode -runAs32
$job| Wait-Job |Receive-Job
Remove-Job $job
"Done"

Twitter This Tip!
ReTweet this Tip!