I have a script that needs to run in 32bit powershell. I want to, at run time, determine if it is running in 32 or 64 bit powershell, and if 64bit, switch dynamically to 32bit.
Basically the exact opposite of this.
if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") {
write-warning "Y'arg Matey, we're off to 64-bit land....."
if ($myInvocation.Line) {
&"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line
}else{
&"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args
}
exit $lastexitcode
}
But for some reason I can not figure out how to reverse this. Please help.