Win32_OperatingSystem 类属性包括版本和服务包信息。 你可以明确仅选择这些属性,以从 Win32_OperatingSystem 获取版本信息摘要:

Get-CimInstance -ClassName Win32_OperatingSystem |
  Select-Object -Property BuildNumber,BuildType,OSType,ServicePackMajorVersion,ServicePackMinorVersion

也可以将通配符用于 Select-Object 的 Property 参数 。 因为在此处使用以 Build 或 ServicePack 开头的所有属性很重要,所以我们可以将此缩短为下列形式:

PS C:\Users\maxsu> Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Build*,OSType,ServicePack*


BuildNumber             : 18362
BuildType               : Multiprocessor Free
OSType                  : 18
ServicePackMajorVersion : 0
ServicePackMinorVersion : 0