2010-01-30

PowerShell version

It seems like there are several ways to get the version of my PowerShell.

I mostly use the variable $host
TryMe> $Host

The result is not a sigle value, but such I get by
TryMe> $Host.Version

Again not a single value. The major version is what I mostly need
TryMe> $Host.Version.Major

Actually $Host return the same as Get-Host.

Another usefull variable is $PSVersionTable. It gives a collection of objects
TryMe> $PSVersionTable

The funny part is when you access the PSVersion element
TryMe> $PSVersionTable.PSVersion
You get the same result as from $Host.Version.