Check Windows PowerShell Version and Architecture

Check Windows PowerShell Version and Architecture

Q: How can I quickly check the Windows PowerShell version and architecture of a PowerShell session?

A: I was recently speaking at an event, and I needed to quickly demonstrate differences between PowerShell versions and architectures when calling from different methods. The easiest way to show the PowerShell version and architecture I found was as follows:

$version = $PSVersiontable.PSVersion
$arch = [intptr]::Size

The $version variable will contain the PowerShell version such as version 2.0 or 3.0. The $arch will have a value of 4 for 32-bit and 8 for 64-bit.

Hide comments