How to Check Powershell version

01 June,2017 by Jack Vamvas

Checking the Powershell version is a requirement for an upgrade cycle. How can I programatically extract the Powershell version and create a report . This would allow me to include a check before I execute some code?

Answer: The Powershell version can be extracted from the $PSVersionTable variable. The $PSVersionTable contains other information which I’ve included in this output.

 

 

PS > $PSVersionTable
Name                           Value
----                           -----
CLRVersion                     2.0.50727.5485
BuildVersion                   6.1.7601.17514
PSVersion                      2.0
WSManStackVersion              2.0
PSCompatibleVersions           {1.0, 2.0}
SerializationVersion           1.1.0.1
PSRemotingProtocolVersion      2.1

 

To get only the PSVersion use    $PSVersionTable.PSVersion


Author: Jack Vamvas (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on How to Check Powershell version


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer