Finding the PS version and process architecture and change 64bit to 32 bit vice versa

Powershell environement

 

to get the version

 

$host.version 

[Environment]::Is64BitProcess

Below script will force the shell to 32 bit process

if ($env:Processor_Architecture -ne "x86")
{
write-warning "Running x86 PowerShell..." 
&"$env:WINDIR\syswow64\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line
exit
}
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s