Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to Check Powershell version

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



This post first appeared on SQLSERVER-DBA.com, please read the originial post: here

Share the post

How to Check Powershell version

×

Subscribe to Sqlserver-dba.com

Get updates delivered right to your inbox!

Thank you for your subscription

×