Determine installed PowerShell version

前端 未结 19 2396
半阙折子戏
半阙折子戏 2020-11-22 09:40

How can I determine what version of PowerShell is installed on a computer, and indeed if it is installed at all?

19条回答
  •  孤街浪徒
    2020-11-22 10:06

    I would use either Get-Host or $PSVersionTable. As Andy Schneider points out, $PSVersionTable doesn't work in version 1; it was introduced in version 2.

    get-host
    
    Name             : ConsoleHost
    Version          : 2.0
    InstanceId       : d730016e-2875-4b57-9cd6-d32c8b71e18a
    UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
    CurrentCulture   : en-GB
    CurrentUICulture : en-US
    PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
    IsRunspacePushed : False
    Runspace         : System.Management.Automation.Runspaces.LocalRunspace
    
    $PSVersionTable
    
    Name                           Value
    ----                           -----
    CLRVersion                     2.0.50727.4200
    BuildVersion                   6.0.6002.18111
    PSVersion                      2.0
    WSManStackVersion              2.0
    PSCompatibleVersions           {1.0, 2.0}
    SerializationVersion           1.1.0.1
    PSRemotingProtocolVersion      2.1
    

提交回复
热议问题