$PSVersionTable

PowerShell のバージョンやビルドなどの情報が格納されているシェル変数

Name 1.0 2.0 3.0 4.0 5.x
BuildVersion
CLRVersion
PSCompatibleVersions
PSEdition
PSRemotingProtocolVersion
PSVersion
SerializationVersion
WSManStackVersion

5.1

PS C:\> $PSVersionTable

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


PS C:\>

4.0

PS C:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      4.0
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.34014
BuildVersion                   6.3.9600.16394
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion      2.2


PS C:\>

3.0

PS C:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      3.0
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.18449
BuildVersion                   6.2.9200.16434
PSCompatibleVersions           {1.0, 2.0, 3.0}
PSRemotingProtocolVersion      2.2


PS C:\>

2.0

PS C:\> $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


PS C:\>
PS C:\> $PSVersion = $PSVersionTable.PSVersion
PS C:\> [string]$PSVersion.Major + "." + [string]$PSVersion.Minor
2.0
PS C:\>
コメントを入力:
 
  • language/powershell/variable/psversiontable
  • 最終更新: 2019/06/11
  • by chibatono