When running a PowerShell script on a x64-bit OS platform, how can you determine in the script what version of PowerShell (32-bit or 64-bit) the script is running on?
Background
Both 32-bit and 64-bit versions of PowerShell are installed by default on a 64-bit platform such as Windows Server 2008. This can lead to difficulties when a PowerShell script is ran that must target a specific architecture (i.e. using 64-bit for a script for SharePoint 2010, in order to consume the 64-bit libraries).
Related question:
We can do this by simply checking the SizeOf a System. IntPtr. If the result of the above statement is 4, it is running in a 32-bit of PowerShell. If the result of the above statement is 8, it is running in a 64-bit of PowerShell.
Open the Task Manager by simultaneously pressing the Ctrl + Shift + Esc keys on your keyboard. Then, click on the Processes tab. In the Processes tab, you see the list of processes that are running at the moment. If a program is 32-bit, near its name you should see the text: *32.
Launch the target program you want to check if it's 32-bit or 64-bit, then open Task Manager and go to the Details tab. Right-click on a column header and choose Select columns. Check the Platform box, and click OK. Under the Platform column, you can easily see if a particular program on you system is 32-bit or 64-bit.
To See if Process is 32-bit or 64-bit in Processes tab in Task Manager. 1 Open Task Manager in more details view. If you see (32-bit) in the process name, then the process is 32-bit. If you don't see (32-bit) in the process name, then the process is 64-bit.
If you're shell is running on .NET 4.0 (PowerShell 3.0):
PS> [Environment]::Is64BitProcess True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With