What was my PowerShell version again?
Posted: (EET/GMT+2)
In the classic Windows command prompt, you can simply type "ver" to get the operating system version, and thus the version of supported commands by "cmd.exe". But, how would you do this in PowerShell?
If you try to run "ver" or even "version", you simply get an error. The correct way to check PowerShell's version on a particular machine is to use an automatic variable called "$PSVersionTable". This object contains a property called "PSVersion", which is what you are looking for:
PS C:\> $PSVersionTable.PSVersion Major Minor Build Revision ----- ----- ----- -------- 4 0 -1 -1
Note that you can also query the "$PSVersionTable" variable directly, and get additional useful information. Such as:
Name Value
---- -----
PSVersion 4.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.42000
BuildVersion 6.3.9600.17400
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion 2.2
Happy scripting!