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:
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:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$MajorVersion = $PSVersionTable.PSVersion.Major | |
$MinorVersion = $PSVersionTable.PSVersion.Minor | |
Write-Host "The currently installed version of PowerShell is $MajorVersion.$MinorVersion" |
No comments:
Post a Comment