How to get the Version of PowerShell

We have installed PowerShell and started creating scripts. Before executing script on current PowerShell version, we should get the Powershell version. Following are ways to get version.

If we want to get the Version of PowerShell, use $PSVersionTable

PS C:\> $PSVersionTable
Name Value
—- —–
PSVersion 4.0
WSManStackVersion 3.0
CLRVersion 4.0.30319.42000
BuildVersion 6.3.9600.16406
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion 2.2

If we want to get detailed PowerShell version,

PS C:\> $PSVersionTable.PSVersion
Major Minor Build Revision
—– —– —– ——–
4 0 -1 -1

$PSVersionTable is not supported in PowerShell 1.0. $PSVersionTable is introduced from 2.0. If we want to get PowerShell version then use Get-Host.

PS C:\> Get-Host
Name : ConsoleHost
Version : 4.0
InstanceId : 18edbf2d-79ce-48b9-bf57-6fbc748b0046
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-US
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace

To Check PowerShell thorugh Registry:

Open registry and navigate to following path,
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1 or 3\PowerShellEngine\

How to get the Version of PowerShell

Related Posts

Responses are currently closed, but you can trackback from your own site.

Comments are closed.

Powered by k2schools
%d bloggers like this: