OSの情報を確認する

環境

  • Windows Server 2019 Datacenter Evaluation
  • Windows Server 2016 Datacenter Evaluation
  • Windows Server 2012 R2 Datacenter
  • Windows Server 2008 R2 Datacenter
  • Windows Server 2003 Standard Edition SP2
  • Windows 10 Enterprise Evaluation

各サーバとクライアントはドメインに参加しており、Windows10から各種コマンドを操作するものとします。

OS情報を取得

OSの情報は、「Get-WmiObject Win32_OperatingSystem」で確認できます。デフォルトではSystemDirectory、Organization、BuildNumber、RegisteredUser、SerialNumber、Versionの情報を表示します。

Windows Server 2019

Get-WmiObject Win32_OperatingSystem -ComputerName windows2019

SystemDirectory : C:\Windows\system32
Organization    : 
BuildNumber     : 17763
RegisteredUser  : Windows ユーザー
SerialNumber    : 00431-20000-00000-AA661
Version         : 10.0.17763

Windows Server 2016

Get-WmiObject Win32_OperatingSystem -ComputerName windows2016

SystemDirectory : C:\Windows\system32
Organization    : 
BuildNumber     : 14393
RegisteredUser  : Windows ユーザー
SerialNumber    : 00377-10000-00000-AA360
Version         : 10.0.14393

Windows Server 2012 R2

Get-WmiObject Win32_OperatingSystem -ComputerName windows2012

SystemDirectory : C:\Windows\system32
Organization    : 
BuildNumber     : 9600
RegisteredUser  : Windows ユーザー
SerialNumber    : 00252-90000-00000-AA632
Version         : 6.3.9600

Windows Server 2008 R2

Get-WmiObject Win32_OperatingSystem -ComputerName windows2008

SystemDirectory : C:\Windows\system32
Organization    : 
BuildNumber     : 7601
RegisteredUser  : Windows ユーザー
SerialNumber    : 00496-001-0001526-84989
Version         : 6.1.7601

Windows Server 2003

Get-WmiObject Win32_OperatingSystem -ComputerName windows2003

SystemDirectory : C:\WINDOWS\system32
Organization    : self
BuildNumber     : 3790
RegisteredUser  : UserName
SerialNumber    : 69833-640-7917004-45418
Version         : 5.2.3790

OS名の取得

OS名はプロパティ名(Caption)を指定することで取得できます。

Windows Server 2019

Get-WmiObject Win32_OperatingSystem -ComputerName windows2019 | select Caption

Caption                                            
-------                                            
Microsoft Windows Server 2019 Datacenter Evaluation

Windows Server 2016

Get-WmiObject Win32_OperatingSystem -ComputerName windows2016 | select Caption

Caption                                            
-------                                            
Microsoft Windows Server 2016 Datacenter Evaluation

Windows Server 2012 R2

Get-WmiObject Win32_OperatingSystem -ComputerName windows2012 | select Caption

Caption                                        
-------                                        
Microsoft Windows Server 2012 R2 Datacenter

Windows Server 2008 R2

Get-WmiObject Win32_OperatingSystem -ComputerName windows2008 | select Caption

Caption                                     
-------                                     
Microsoft Windows Server 2008 R2 Datacenter

Windows Server 2003

Get-WmiObject Win32_OperatingSystem -ComputerName windows2003 | select Caption

Caption                                              
-------                                              
Microsoft(R) Windows(R) Server 2003, Standard Edition

参考

メンバー情報を確認する

Get-WmiObject Win32_OperatingSystemには多くのメソッドやプロパティがあります。get-memberで確認してみましょう。

> Get-WmiObject Win32_OperatingSystem | Get-Member


   TypeName: System.Management.ManagementObject#root\cimv2\Win32_OperatingSystem

Name                                      MemberType    Definition                                          
----                                      ----------    ----------                                          
PSComputerName                            AliasProperty PSComputerName = __SERVER                           
Reboot                                    Method        System.Management.ManagementBaseObject Reboot()     
SetDateTime                               Method        System.Management.ManagementBaseObject SetDateTim...
Shutdown                                  Method        System.Management.ManagementBaseObject Shutdown()   
Win32Shutdown                             Method        System.Management.ManagementBaseObject Win32Shutd...
Win32ShutdownTracker                      Method        System.Management.ManagementBaseObject Win32Shutd...
BootDevice                                Property      string BootDevice {get;set;}                        
BuildNumber                               Property      string BuildNumber {get;set;}                       
BuildType                                 Property      string BuildType {get;set;}                         
Caption                                   Property      string Caption {get;set;}                           
CodeSet                                   Property      string CodeSet {get;set;}                           
CountryCode                               Property      string CountryCode {get;set;}                       
CreationClassName                         Property      string CreationClassName {get;set;}                 
CSCreationClassName                       Property      string CSCreationClassName {get;set;}               
CSDVersion                                Property      string CSDVersion {get;set;}                        
CSName                                    Property      string CSName {get;set;}                            
CurrentTimeZone                           Property      int16 CurrentTimeZone {get;set;}                    
DataExecutionPrevention_32BitApplications Property      bool DataExecutionPrevention_32BitApplications {g...
DataExecutionPrevention_Available         Property      bool DataExecutionPrevention_Available {get;set;}   
DataExecutionPrevention_Drivers           Property      bool DataExecutionPrevention_Drivers {get;set;}     
DataExecutionPrevention_SupportPolicy     Property      byte DataExecutionPrevention_SupportPolicy {get;s...
Debug                                     Property      bool Debug {get;set;}                               
Description                               Property      string Description {get;set;}                       
Distributed                               Property      bool Distributed {get;set;}                         
EncryptionLevel                           Property      uint32 EncryptionLevel {get;set;}                   
ForegroundApplicationBoost                Property      byte ForegroundApplicationBoost {get;set;}          
FreePhysicalMemory                        Property      uint64 FreePhysicalMemory {get;set;}                
FreeSpaceInPagingFiles                    Property      uint64 FreeSpaceInPagingFiles {get;set;}            
FreeVirtualMemory                         Property      uint64 FreeVirtualMemory {get;set;}                 
InstallDate                               Property      string InstallDate {get;set;}                       
LargeSystemCache                          Property      uint32 LargeSystemCache {get;set;}                  
LastBootUpTime                            Property      string LastBootUpTime {get;set;}                    
LocalDateTime                             Property      string LocalDateTime {get;set;}                     
Locale                                    Property      string Locale {get;set;}                            
Manufacturer                              Property      string Manufacturer {get;set;}                      
MaxNumberOfProcesses                      Property      uint32 MaxNumberOfProcesses {get;set;}              
MaxProcessMemorySize                      Property      uint64 MaxProcessMemorySize {get;set;}              
MUILanguages                              Property      string[] MUILanguages {get;set;}                    
Name                                      Property      string Name {get;set;}                              
NumberOfLicensedUsers                     Property      uint32 NumberOfLicensedUsers {get;set;}             
NumberOfProcesses                         Property      uint32 NumberOfProcesses {get;set;}                 
NumberOfUsers                             Property      uint32 NumberOfUsers {get;set;}                     
OperatingSystemSKU                        Property      uint32 OperatingSystemSKU {get;set;}                
Organization                              Property      string Organization {get;set;}                      
OSArchitecture                            Property      string OSArchitecture {get;set;}                    
OSLanguage                                Property      uint32 OSLanguage {get;set;}                        
OSProductSuite                            Property      uint32 OSProductSuite {get;set;}                    
OSType                                    Property      uint16 OSType {get;set;}                            
OtherTypeDescription                      Property      string OtherTypeDescription {get;set;}              
PAEEnabled                                Property      bool PAEEnabled {get;set;}                          
PlusProductID                             Property      string PlusProductID {get;set;}                     
PlusVersionNumber                         Property      string PlusVersionNumber {get;set;}                 
PortableOperatingSystem                   Property      bool PortableOperatingSystem {get;set;}             
Primary                                   Property      bool Primary {get;set;}                             
ProductType                               Property      uint32 ProductType {get;set;}                       
RegisteredUser                            Property      string RegisteredUser {get;set;}                    
SerialNumber                              Property      string SerialNumber {get;set;}                      
ServicePackMajorVersion                   Property      uint16 ServicePackMajorVersion {get;set;}           
ServicePackMinorVersion                   Property      uint16 ServicePackMinorVersion {get;set;}           
SizeStoredInPagingFiles                   Property      uint64 SizeStoredInPagingFiles {get;set;}           
Status                                    Property      string Status {get;set;}                            
SuiteMask                                 Property      uint32 SuiteMask {get;set;}                         
SystemDevice                              Property      string SystemDevice {get;set;}                      
SystemDirectory                           Property      string SystemDirectory {get;set;}                   
SystemDrive                               Property      string SystemDrive {get;set;}                       
TotalSwapSpaceSize                        Property      uint64 TotalSwapSpaceSize {get;set;}                
TotalVirtualMemorySize                    Property      uint64 TotalVirtualMemorySize {get;set;}            
TotalVisibleMemorySize                    Property      uint64 TotalVisibleMemorySize {get;set;}            
Version                                   Property      string Version {get;set;}                           
WindowsDirectory                          Property      string WindowsDirectory {get;set;}                  
__CLASS                                   Property      string __CLASS {get;set;}                           
__DERIVATION                              Property      string[] __DERIVATION {get;set;}                    
__DYNASTY                                 Property      string __DYNASTY {get;set;}                         
__GENUS                                   Property      int __GENUS {get;set;}                              
__NAMESPACE                               Property      string __NAMESPACE {get;set;}                       
__PATH                                    Property      string __PATH {get;set;}                            
__PROPERTY_COUNT                          Property      int __PROPERTY_COUNT {get;set;}                     
__RELPATH                                 Property      string __RELPATH {get;set;}                         
__SERVER                                  Property      string __SERVER {get;set;}                          
__SUPERCLASS                              Property      string __SUPERCLASS {get;set;}                      
FREE                                      PropertySet   FREE {FreePhysicalMemory, FreeSpaceInPagingFiles,...
PSStatus                                  PropertySet   PSStatus {Status, Name}                             
ConvertFromDateTime                       ScriptMethod  System.Object ConvertFromDateTime();                
ConvertToDateTime                         ScriptMethod  System.Object ConvertToDateTime();   

全プロパティの情報を表示させるにはアスタリスクを使用します。欲しい情報がないか探す時には便利です。

> Get-WmiObject Win32_OperatingSystem | select *


PSComputerName                            : WINDOWS10
Status                                    : OK
Name                                      : Microsoft Windows 10 Enterprise Evaluation|C:\Windows|\Device\Ha
                                            rddisk0\Partition4
FreePhysicalMemory                        : 1947516
FreeSpaceInPagingFiles                    : 699512
FreeVirtualMemory                         : 2367912
__GENUS                                   : 2
__CLASS                                   : Win32_OperatingSystem
__SUPERCLASS                              : CIM_OperatingSystem
__DYNASTY                                 : CIM_ManagedSystemElement
__RELPATH                                 : Win32_OperatingSystem=@
__PROPERTY_COUNT                          : 64
__DERIVATION                              : {CIM_OperatingSystem, CIM_LogicalElement, CIM_ManagedSystemEleme
                                            nt}
__SERVER                                  : WINDOWS10
__NAMESPACE                               : root\cimv2
__PATH                                    : \\WINDOWS10\root\cimv2:Win32_OperatingSystem=@
BootDevice                                : \Device\HarddiskVolume2
BuildNumber                               : 17134
BuildType                                 : Multiprocessor Free
Caption                                   : Microsoft Windows 10 Enterprise Evaluation
CodeSet                                   : 932
CountryCode                               : 81
CreationClassName                         : Win32_OperatingSystem
CSCreationClassName                       : Win32_ComputerSystem
CSDVersion                                : 
CSName                                    : WINDOWS10
CurrentTimeZone                           : 540
DataExecutionPrevention_32BitApplications : True
DataExecutionPrevention_Available         : True
DataExecutionPrevention_Drivers           : True
DataExecutionPrevention_SupportPolicy     : 2
Debug                                     : False
Description                               : 
Distributed                               : False
EncryptionLevel                           : 256
ForegroundApplicationBoost                : 2
InstallDate                               : 20200320005953.000000+540
LargeSystemCache                          : 
LastBootUpTime                            : 20200404005903.500000+540
LocalDateTime                             : 20200404080802.688000+540
Locale                                    : 0411
Manufacturer                              : Microsoft Corporation
MaxNumberOfProcesses                      : 4294967295
MaxProcessMemorySize                      : 137438953344
MUILanguages                              : {ja-JP}
NumberOfLicensedUsers                     : 0
NumberOfProcesses                         : 135
NumberOfUsers                             : 7
OperatingSystemSKU                        : 72
Organization                              : 
OSArchitecture                            : 64 ビット
OSLanguage                                : 1041
OSProductSuite                            : 256
OSType                                    : 18
OtherTypeDescription                      : 
PAEEnabled                                : 
PlusProductID                             : 
PlusVersionNumber                         : 
PortableOperatingSystem                   : False
Primary                                   : True
ProductType                               : 1
RegisteredUser                            : root
SerialNumber                              : 00329-20000-00001-AA244
ServicePackMajorVersion                   : 0
ServicePackMinorVersion                   : 0
SizeStoredInPagingFiles                   : 720896
SuiteMask                                 : 272
SystemDevice                              : \Device\HarddiskVolume4
SystemDirectory                           : C:\Windows\system32
SystemDrive                               : C:
TotalSwapSpaceSize                        : 
TotalVirtualMemorySize                    : 4914032
TotalVisibleMemorySize                    : 4193136
Version                                   : 10.0.17134
WindowsDirectory                          : C:\Windows
Scope                                     : System.Management.ManagementScope
Path                                      : \\WINDOWS10\root\cimv2:Win32_OperatingSystem=@
Options                                   : System.Management.ObjectGetOptions
ClassPath                                 : \\WINDOWS10\root\cimv2:Win32_OperatingSystem
Properties                                : {BootDevice, BuildNumber, BuildType, Caption...}
SystemProperties                          : {__GENUS, __CLASS, __SUPERCLASS, __DYNASTY...}
Qualifiers                                : {dynamic, Locale, provider, Singleton...}
Site                                      : 
Container                                 : 

ワークグループに属しているサーバの情報を取得する

サーバがワークグループに属している場合は、以下のコマンドで情報を取得できます。パスワードは認証画面で入力します。

(Get-WmiObject -computername ホスト名(IPアドレス) -Credential ユーザー名 Win32_OperatingSystem).Caption

コマンド内にパスワードを組み込みます。

(Get-WmiObject -computername ホスト名(IPアドレス) -Credential (New-Object System.Management.Automation.PSCredential("ユーザー名", (ConvertTo-SecureString –String "パスワード" –AsPlainText -Force))) Win32_OperatingSystem).Caption

ビルド番号とOS名の対比表

【サーバ情報】

製品名バージョン番号ビルド番号
Windows Server バージョン 180310.017134
Windows Server バージョン 1709 10.016299
Windows Server 201610.014393
Windows Server 2012 R26.39600
Windows Server 20126.29200
Windows Server 2008 R2 SP16.17601
Windows Server 2008 R26.17600
Windows Server 2008 SP26.06002
Windows Server 2008 SP16.06001
Windows Server 2003 R25.23790
Windows Server 20035.23790
Windows 2000 Server5.02195
Windows NT Server 4.04.01381
Windows NT Server 3.513.511057
Windows NT Server 3.53.5807
Windows NT 3.13.1528

【クライアント情報】

製品名バージョン番号ビルド番号
Windows 10 October 2018 Update10.0(バージョン1809)17763
Windows 10 October 2018 Update10.0(バージョン1809)17763
Windows 10 April 2018 Update10.0(バージョン1803)17134
Windows 10 Fall Creators Update10.0(バージョン1709)16299
Windows 10 Creators Update10.0(バージョン1703)15063
Windows 10 Anniversary Update10.0(バージョン1607)14393
Windows 10 November Update10.0(バージョン1511)10586
Windows 1010.010240
Windows 8.16.39600
Windows 86.29200
Windows 7 SP16.17601
Windows 76.17600
Windows Vista SP26.06002
Windows Vista SP16.06001
Windows Vista6.06000
Windows XP 64-Bit Edition5.23790
Windows XP5.12600
Windows 20005.02195
Windows NT 4.013811381
Windows ME(Millennium Edition)4.93000
Windows 98 SE(Second Edition)4.12222
Windows NT 3.513.511057
Windows NT 3.53.5807
Windows NT 3.13.1528
Windows 984.11998
Windows 95 OSR2.54.0950C(1214)
Windows 95 OSR2.14.0950B(1212~1214)
Windows 95 OSR24.0950B(1111)
Windows 95 OSR14.0950a
Windows 95 SP14.0950a
Windows 954.0950
Windows 3.13.1
タイトルとURLをコピーしました