Saturday, July 2, 2016

Check the currently installed version of PowerShell

When I administer servers, I often have a need to determine what version of PowerShell is installed on the server so that I can figure out which of my PowerShell scripts are supported on that particular server platform.

Microsoft has thankfully made this task very simple through the use of the $PSVersionTable.$PSVersion PowerShell command.

I created a small, simple little script which will output the currently installed version of PowerShell:

$MajorVersion = $PSVersionTable.PSVersion.Major
$MinorVersion = $PSVersionTable.PSVersion.Minor
Write-Host "The currently installed version of PowerShell is $MajorVersion.$MinorVersion"

No comments:

Post a Comment