Checking operating system information with WMIC

You can use wmic os get commands on a Microsoft Windows system to view information related to the operating system via a command-line interface (CLI). E.g., to determine the version of the operating system you can issue the command Windows Management Instrumentation Command-line (WMIC) command wmic os get version.

C:\Users\Public>wmic os get version
Version
10.0.15063


C:\Users\Public>

Or if you know the system is running a particular version of the Windows operating system, e.g., Windows 10, but want to see just the build number for that version of Windows, you could issue the command wmic os get BuildNumber.

C:\Users\Public>wmic os get BuildNumber
BuildNumber
15063


C:\Users\Public>

To determine the last time a Microsoft Windows system was rebooted with WMIC, you can use the command wmic os get LastBootUpTime.

C:\Users\Public>wmic os get LastBootUpTime
LastBootUpTime
20171010211214.499885-240


C:\Users\Public>

Other values you can check are shown below:



C:\Users\Public>wmic os get BootDevice
BootDevice
\Device\HarddiskVolume1


C:\Users\Public>wmic os get OSType
OSType
18


C:\Users\Public>wmic os get version
Version
10.0.15063


C:\Users\Public>cd ..\Public

C:\Users\Public>wmic os get status
Status
OK


C:\Users\Public>wmic os get locale
Locale
0409


C:\Users\Public>wmic os get countrycode
CountryCode
1


C:\Users\Public>wmic os get systemdrive
SystemDrive
C:


C:\Users\Public>wmic os get windowsdirectory
WindowsDirectory
C:\WINDOWS


C:\Users\Public>wmic os get OSLanguage
OSLanguage
1033


C:\Users\Public>wmic os get othertypedescription
OtherTypeDescription



C:\Users\Public>wmic os get OSProductSuite
OSProductSuite
256


C:\Users\Public>wmic os get Manufacturer
Manufacturer
Microsoft Corporation


C:\Users\Public>wmic os get CurrentTimeZone
CurrentTimeZone
-240


C:\Users\Public>wmic os get LocalDateTime
LocalDateTime
20171028122315.145000-240


C:\Users\Public>

The CurrentTimeZone value is the number of minutes that the system's time zone differs from UTC time, aka Greenwich Mean Time (GMT) and Zulu time. In this case the system is in the eastern U.S. and is currently 4 hours behind GMT. The LocalDateTime value is in the form YYYYMMDDHHMMSS where YYYY is the year, MM the month, DD the day, HH the hour, and SS the number of seconds, which is followed by fractions of a second. E.g., in the above example, the date is October 28, 2017 and the time is 12:23 PM.

To see the full list of values for which you can query, you can issue the command wmic os get /?.

Udemy - April2516-25off-sitewide120x600

Hide.me 25% discount
C:\Users\Public>wmic os get /?

Property get operations.
USAGE:

GET [<property list>] [<get switches>]
NOTE: <property list> ::= <property name> | <property name>,  <property list>

The following properties are available:
Property                                Type                    Operation
========                                ====                    =========
BootDevice                              N/A                     N/A
BuildNumber                             N/A                     N/A
BuildType                               N/A                     N/A
CSDVersion                              N/A                     N/A
CSName                                  N/A                     N/A
CodeSet                                 N/A                     N/A
CountryCode                             N/A                     N/A
CurrentTimeZone                         N/A                     N/A
Debug                                   N/A                     N/A
Description                             N/A                     N/A
Distributed                             N/A                     N/A
EncryptionLevel                         N/A                     N/A
ForegroundApplicationBoost              N/A                     N/A
FreePhysicalMemory                      N/A                     N/A
FreeSpaceInPagingFiles                  N/A                     N/A
FreeVirtualMemory                       N/A                     N/A
InstallDate                             N/A                     N/A
LastBootUpTime                          N/A                     N/A
LocalDateTime                           N/A                     N/A
Locale                                  N/A                     N/A
Manufacturer                            N/A                     N/A
MaxNumberOfProcesses                    N/A                     N/A
MaxProcessMemorySize                    N/A                     N/A
Name                                    N/A                     N/A
NumberOfLicensedUsers                   N/A                     N/A
NumberOfProcesses                       N/A                     N/A
NumberOfUsers                           N/A                     N/A
OSLanguage                              N/A                     N/A
OSProductSuite                          N/A                     N/A
OSType                                  N/A                     N/A
Organization                            N/A                     N/A
OtherTypeDescription                    N/A                     N/A
PlusProductID                           N/A                     N/A
PlusVersionNumber                       N/A                     N/A
Primary                                 N/A                     N/A
QuantumLength                           N/A                     N/A
QuantumType                             N/A                     N/A
RegisteredUser                          N/A                     N/A
SerialNumber                            N/A                     N/A
ServicePackMajorVersion                 N/A                     N/A
ServicePackMinorVersion                 N/A                     N/A
SizeStoredInPagingFiles                 N/A                     N/A
Status                                  N/A                     N/A
SystemDevice                            N/A                     N/A
SystemDirectory                         N/A                     N/A
SystemDrive                             N/A                     N/A
TotalSwapSpaceSize                      N/A                     N/A
TotalVirtualMemorySize                  N/A                     N/A
TotalVisibleMemorySize                  N/A                     N/A
Version                                 N/A                     N/A
WindowsDirectory                        N/A                     N/A

The following GET switches are available:

/VALUE                       - Return value.
/ALL(default)                - Return the data and metadata for the attribute.
/TRANSLATE:<table name>      - Translate output via values from <table name>.
/EVERY:<interval> [/REPEAT:<repeat count>] - Returns value every (X interval) se
conds, If /REPEAT specified the command is executed <repeat count> times.
/FORMAT:<format specifier>   - Keyword/XSL filename to process the XML results.

NOTE: Order of /TRANSLATE and /FORMAT switches influences the appearance of outp
ut.
Case1: If /TRANSLATE precedes /FORMAT, then translation of results will be follo
wed by formatting.
Case2: If /TRANSLATE succeeds /FORMAT, then translation of the formatted results
 will be done.


C:\Users\Public>

Related articles:

  1. WMIC Share Get
  2. Determining S.M.A.R.T disk drive status from a command prompt
  3. Show all drives from Windows command prompt