PowerShell for Windows Admins

Nov 14 2017   8:45AM GMT

PowerShell version

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Tags:
Powershell

Depending on the version of Windows you’re running you could be using PowerShell version 1 through version 5.1 (admittedly I suspect there are very few people, if any, still running PowerShell v1). This is complicated by the various versions of Windows Management Framework that are available for download and the large number of alpha and beta versions of PowerShell v6 that have been made available. So how do you know which PowerShell version you have on any given machine?

The easiest way is to use the $PSVersiontable automatic variable. On a Windows 10 machine you’ll see something like this:

PS> $PSVersionTable

Name Value
 ---- -----
PSVersion 5.1.16299.19
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.16299.19
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Notice the PSVersion property. You could just type

PS> $PSVersionTable.PSVersion

Major Minor Build Revision
 ----- ----- ----- --------
 5 1 16299 19

On PowerShell v1 $PSVersionTable doesn’t exist so you’ll get nothing returned.

A PowerShell v6 instance on Windows will return

PS C:\Program Files\PowerShell\6.0.0-beta.9> $PSVersionTable

Name Value
 ---- -----
PSVersion 6.0.0-beta.9
PSEdition Core
GitCommitId v6.0.0-beta.9
 OS Microsoft Windows 10.0.17035
 Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Notice the similarities and differences – especially the PSEdition property

PowerShell v6 on Linux gives something similar

Name Value
 ---- -----
PSVersion 6.0.0-beta.9
PSEdition Core
GitCommitId v6.0.0-beta.9
 OS Linux 3.10.0-514.6.1.el7.x86_64 #1 SMP Wed Ja...
 Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

When looking at PowerShell versions remember that functionality was introduced in this order:

PowerShell v1 – basic core cmdlets

PowerShell v2 – remoting, modules, jobs, WMI cmdlets (apart form Get-WmiObject)

PowerShell v3 – CIM cmldets, CIM sessions, workflows

PowerShell v4 – DSC

PowerShell v5 – PowerShell classes

PowerShell v6 – check the release notes as it changes so much at the moment

 

 

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: