Windows: Check if Powershell process is the 32 or 64 Bit Version

Hi,

sometimes it is importend, when writing to the registry or file system in regions where the architecture redirection active, to known on which version a script runs.

This can be simply that by the size of an integer pointer. The size on 32Bit Systems is 4 Bytes and on 64Bit systems 8 Byte.

PS D:\> if([System.IntPtr]::Size -eq 4)
{
    write-host "32 Bit"
}
else
{
    write-host "64 Bit"
}

Michael