Examples
There is always exactly one instance of Win32_OperatingSystem available, representing your current installation of Windows:
Get-CimInstance -ClassName Win32_OperatingSystem
By default, PowerShell returns a subset of all available properties:
SystemDirectory Organization BuildNumber RegisteredUser SerialNumber Version
--------------- ------------ ----------- -------------- ------------ -------
C:\Windows\system32 psconf.eu 18363 [email protected] 00330-50000-00000-AAOEM 10.0.18363
To view all available properties, use Select-Object
. This command returns all available properties:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property *
Sample results
Status : OK
Name : Microsoft Windows 10 Pro|C:\Windows|\Device\Harddisk0\Partition3
FreePhysicalMemory : 19555920
FreeSpaceInPagingFiles : 4927960
FreeVirtualMemory : 22870064
Caption : Microsoft Windows 10 Pro
Description :
InstallDate : 03.09.2019 12:42:41
CreationClassName : Win32_OperatingSystem
CSCreationClassName : Win32_ComputerSystem
CSName : DELL7390
CurrentTimeZone : 120
Distributed : False
LastBootUpTime : 27.04.2020 00:06:48
LocalDateTime : 28.04.2020 11:08:08
MaxNumberOfProcesses : 4294967295
MaxProcessMemorySize : 137438953344
NumberOfLicensedUsers :
NumberOfProcesses : 265
NumberOfUsers : 2
OSType : 18
OtherTypeDescription :
SizeStoredInPagingFiles : 4980736
TotalSwapSpaceSize :
TotalVirtualMemorySize : 38297380
TotalVisibleMemorySize : 33316644
Version : 10.0.18363
BootDevice : \Device\HarddiskVolume1
BuildNumber : 18363
BuildType : Multiprocessor Free
CodeSet : 1252
CountryCode : 49
CSDVersion :
DataExecutionPrevention_32BitApplications : True
DataExecutionPrevention_Available : True
DataExecutionPrevention_Drivers : True
DataExecutionPrevention_SupportPolicy : 2
Debug : False
EncryptionLevel : 256
ForegroundApplicationBoost : 2
LargeSystemCache :
Locale : 0407
Manufacturer : Microsoft Corporation
MUILanguages : {de-DE, en-US}
OperatingSystemSKU : 48
Organization : psconf.eu
OSArchitecture : 64-bit
OSLanguage : 1031
OSProductSuite : 256
PAEEnabled :
PlusProductID :
PlusVersionNumber :
PortableOperatingSystem : False
Primary : True
ProductType : 1
RegisteredUser : [email protected]
SerialNumber : 00330-50000-00000-AAOEM
ServicePackMajorVersion : 0
ServicePackMinorVersion : 0
SuiteMask : 272
SystemDevice : \Device\HarddiskVolume3
SystemDirectory : C:\Windows\system32
SystemDrive : C:
WindowsDirectory : C:\Windows
PSComputerName :
CimClass : root/cimv2:Win32_OperatingSystem
CimInstanceProperties : {Caption, Description, InstallDate, Name...}
CimSystemProperties : Microsoft.Management.Infrastructure.CimSystemProperties
Some information is encoded and uses numeric constants. Look up individual properties below for detailed information.
From the list of all available properties, select the ones that you find interesting, for example:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Caption, Version, InstallDate, LastBootupTime
The result looks similar to this:
Caption Version InstallDate LastBootupTime
------- ------- ----------- --------------
Microsoft Windows 10 Pro 10.0.18363 03.09.2019 12:42:41 27.04.2020 00:06:48
Dumping Date and Time Information
To get information about dates and times, including last bootup time and installation time, use this:
$dateTimeProps = 'InstallDate', 'LastBootupTime', 'LocalDateTime', 'CurrentTimeZone', 'CountryCode'
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property $dateTimeProps
The result looks similar to this:
InstallDate : 03.09.2019 12:42:41
LastBootupTime : 03.05.2020 12:15:45
LocalDateTime : 04.05.2020 10:43:55
CurrentTimeZone : 120
CountryCode : 49
If you’d like to know how many minutes your system is running, or how many days have been passed since it was installed, use New-TimeSpan
:
$os = Get-CimInstance -ClassName Win32_OperatingSystem
$installedDays = (New-TimeSpan -Start $os.InstallDate).Days
$runningMinutes = [int](New-TimeSpan -Start $os.LastBootupTime).TotalMinutes
"Your copy of windows was installed $installedDays days ago."
"Your system is up for {0:n0} minutes." -f $runningMinutes
Note the use of the operator -f in the second outputted line: the placeholder {0:n0} instructs PowerShell to format the number with separators and no digits after the decimal.
The result looks similar to this:
Your copy of windows was installed 243 days ago.
Your system is up for 1.353 minutes.
Remote Access
To access remote system(s), use the parameter -ComputerName:
Get-CimInstance -ClassName Win32_OperatingSystem -ComputerName webserver12
Learn more about accessing remote computers.
Removing Empty Properties
To eliminate all empty properties and show only properties with content, try this:
# get all WMI information:
$os = Get-CimInstance -ClassName Win32_OperatingSystem
# find names of non-empty properties:
$filledProperties = $os.PSObject.Properties.Name.Where{![string]::IsNullOrWhiteSpace($os.$_)} | Sort-Object
# show non-empty properties only:
$os | Select-Object -Property $filledProperties
To turn the object into a hashtable and show it in a gridview as a table, try this:
# get all WMI information:
$os = Get-CimInstance -ClassName Win32_OperatingSystem
# find names of non-empty properties:
$filledProperties = $os.PSObject.Properties.Name.Where{![string]::IsNullOrWhiteSpace($os.$_)} | Sort-Object
# turn object into hashtable and show in gridview
$filledProperties | ForEach-Object { $hash = [Ordered]@{} } { $hash[$_] = $os.$_ } { $hash } | Out-GridView
When you convert an object into a hashtable, the gridview shows one property per line, and you can now use the text filter box on top of the gridview to easily filter and search for information. This technique can generally be useful when visualizing exactly one object.
More Reading
Get-ComputerInfo was introduced in PowerShell 5 and provides similar information about your system. You can also read from the registry selected operating system information such as version, build information, release ids, and UBR number.
To simplify the use of WMI, you might want to turn Win32_OperatingSystem into CDXML cmdlets.
Methods
Win32_OperatingSystem has 5 methods:
Method | Description |
---|---|
Reboot | Shuts down and then restarts the computer system. |
SetDateTime | Allows the computer date and time to be set. |
Shutdown | Unloads programs and DLLs to the point where it is safe to turn off the computer. |
Win32Shutdown | Provides the full set of shutdown options supported by Windows operating systems. |
Win32ShutdownTracker | Provides the same set of shutdown options supported by Win32Shutdown() but also allows you to specify comments, a reason for shutdown, or a timeout. |
Learn more about Invoke-CimMethod
and how to invoke commands. Click any of the methods listed above to learn more about their purpose, parameters, and return value.
Properties
Win32_OperatingSystem returns 61 properties:
'BootDevice','BuildNumber','BuildType','Caption','CodeSet','CountryCode',
'CreationClassName','CSCreationClassName','CSDVersion','CSName','CurrentTimeZone',
'DataExecutionPrevention_32BitApplications','DataExecutionPrevention_Available','DataExecutionPrevention_Drivers',
'DataExecutionPrevention_SupportPolicy','Debug','Description','Distributed','EncryptionLevel','ForegroundApplicationBoost',
'FreePhysicalMemory','FreeSpaceInPagingFiles','FreeVirtualMemory','InstallDate','LastBootUpTime',
'LocalDateTime','Locale','Manufacturer','MaxNumberOfProcesses','MaxProcessMemorySize','MUILanguages',
'Name','NumberOfLicensedUsers','NumberOfProcesses','NumberOfUsers','OperatingSystemSKU',
'Organization','OSArchitecture','OSLanguage','OSProductSuite','OSType','OtherTypeDescription',
'PAEEnabled','PortableOperatingSystem','Primary','ProductType','RegisteredUser','SerialNumber',
'ServicePackMajorVersion','ServicePackMinorVersion','SizeStoredInPagingFiles','Status','SuiteMask',
'SystemDevice','SystemDirectory','SystemDrive','TotalSwapSpaceSize','TotalVirtualMemorySize',
'TotalVisibleMemorySize','Version','WindowsDirectory'
Unless explicitly marked as WRITEABLE, all properties are read-only.
BootDevice
Name of the disk drive from which the Windows operating system starts. Example: “\Device\Harddisk0”
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property BootDevice
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty BootDevice
"BootDevice = $value"
BuildNumber
Build number of an operating system. It can be used for more precise version information than product release version numbers.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property BuildNumber
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber
"BuildNumber = $value"
BuildType
Type of build used for an operating system.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property BuildType
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty BuildType
"BuildType = $value"
Caption
Short description of the object. The string includes the operating system version.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Caption
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty Caption
"Caption = $value"
CodeSet
Code page value an operating system uses. A code page contains a character table that an operating system uses to translate strings for different languages. The American National Standards Institute (ANSI) lists values that represent defined code pages. If an operating system does not use an ANSI code page, this member is set to 0 (zero). The CodeSet string can use a maximum of six characters to define the code page value. Example: “1255”
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property CodeSet
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty CodeSet
"CodeSet = $value"
CountryCode
Code for the country/region that an operating system uses. Values are based on international phone dialing prefixes also referred to as IBM country/region codes. This property can use a maximum of six characters to define the country/region code value.
Example: “1” (United States)
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property CountryCode
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty CountryCode
"CountryCode = $value"
CreationClassName
Name of the first concrete class that appears in the inheritance chain used in the creation of an instance. When used with other key properties of the class, this property allows all instances of this class and its subclasses to be identified uniquely.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property CreationClassName
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty CreationClassName
"CreationClassName = $value"
CSCreationClassName
Creation class name of the scoping computer system.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property CSCreationClassName
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty CSCreationClassName
"CSCreationClassName = $value"
CSDVersion
NULL-terminated string that indicates the latest service pack installed on a computer. If no service pack is installed, the string is NULL. Example: “Service Pack 3”
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property CSDVersion
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty CSDVersion
"CSDVersion = $value"
CSName
Name of the scoping computer system.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property CSName
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty CSName
"CSName = $value"
CurrentTimeZone
Number, in minutes, an operating system is offset from Greenwich mean time (GMT). The number is positive, negative, or zero.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property CurrentTimeZone
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty CurrentTimeZone
"CurrentTimeZone = ${value} minutes"
DataExecutionPrevention_32BitApplications
When the data execution prevention hardware feature is available, this property indicates that the feature is set to work for 32-bit applications if True. On 64-bit computers, the data execution prevention feature is configured in the Boot Configuration Data (BCD) store and the properties in Win32_OperatingSystem are set accordingly.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property DataExecutionPrevention_32BitApplications
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty DataExecutionPrevention_32BitApplications
"DataExecutionPrevention_32BitApplications = $value"
DataExecutionPrevention_Available
Data execution prevention is a hardware feature to prevent buffer overrun attacks by stopping the execution of code on data-type memory pages. If True, then this feature is available. On 64-bit computers, the data execution prevention feature is configured in the BCD store and the properties in Win32_OperatingSystem are set accordingly.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property DataExecutionPrevention_Available
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty DataExecutionPrevention_Available
"DataExecutionPrevention_Available = $value"
DataExecutionPrevention_Drivers
When the data execution prevention hardware feature is available, this property indicates that the feature is set to work for drivers if True. On 64-bit computers, the data execution prevention feature is configured in the BCD store and the properties in Win32_OperatingSystem are set accordingly.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property DataExecutionPrevention_Drivers
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty DataExecutionPrevention_Drivers
"DataExecutionPrevention_Drivers = $value"
DataExecutionPrevention_SupportPolicy
Indicates which Data Execution Prevention (DEP) setting is applied. The DEP setting specifies the extent to which DEP applies to 32-bit applications on the system. DEP is always applied to the Windows kernel.
DataExecutionPrevention_SupportPolicy returns a numeric value. To translate it into a meaningful text, use any of the following approaches:
Use Update-Type
Update-Type
tells PowerShell how to interpret the property. This command needs to be executed only once per PowerShell session:
Update-TypeData -MemberName DataExecutionPrevention_SupportPolicy -TypeName "Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem" -MemberType ScriptProperty -Value {
Enum EnumDataExecutionPrevention_SupportPolicy
{
Always_Off = 0
Always_On = 1
Opt_In = 2
Opt_Out = 3
}
[EnumDataExecutionPrevention_SupportPolicy]($this.PSBase.CimInstanceProperties['DataExecutionPrevention_SupportPolicy'].Value)
} -Force
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property DataExecutionPrevention_SupportPolicy
Use Select-Object
Select-Object
supports calculated properties. When you submit a hashtable, PowerShell dynamically calculates the result:
$DataExecutionPrevention_SupportPolicy = @{
Name = 'DataExecutionPrevention_SupportPolicyText'
Expression = {
$value = $_.DataExecutionPrevention_SupportPolicy
switch([int]$value)
{
0 {'Always Off'}
1 {'Always On'}
2 {'Opt In'}
3 {'Opt Out'}
default {"$value"}
}
}
}
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Caption, DataExecutionPrevention_SupportPolicy, $DataExecutionPrevention_SupportPolicy
Use a PowerShell Hashtable
You can use a PowerShell hashtable to decode numeric values. Use a hashtable like this one:
$DataExecutionPrevention_SupportPolicy_map = @{
0 = 'Always Off'
1 = 'Always On'
2 = 'Opt In'
3 = 'Opt Out'
}
Use Enum structure
You can cast the raw property values to a new enum type to translate raw numeric values into friendly text. Use an enum like this one:
Enum EnumDataExecutionPrevention_SupportPolicy
{
Always_Off = 0
Always_On = 1
Opt_In = 2
Opt_Out = 3
}
Debug
Operating system is a checked (debug) build. If $true
the debugging version is installed. Checked builds provide error checking, argument verification, and system debugging code. Additional code in a checked binary generates a kernel debugger error message and breaks into the debugger. This helps immediately determine the cause and location of the error. Performance may be affected in a checked build due to the additional code that is executed.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Debug
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty Debug
"Debug = $value"
Description
Description of the Windows operating system. Some user interfaces for example, those that allow editing of this description, limit its length to 48 characters.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Description
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty Description
"Description = $value"
Distributed
If $true
the operating system is distributed across several computer system nodes. If so, these nodes should be grouped as a cluster.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Distributed
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty Distributed
"Distributed = $value"
EncryptionLevel
Encryption level for secure transactions: 40-bit, 128-bit, or n-bit. Any number greater than 2 describes the actual number of bits used for encryption. A value of “256” represents 256-bit.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property EncryptionLevel
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty EncryptionLevel
"EncryptionLevel = $value"
ForegroundApplicationBoost
Determines whether foreground (interactively used) applications should receive an increased priority. Application boost is implemented by giving an application more execution time slices (quantum lengths).
ForegroundApplicationBoost returns a numeric value. To translate it into a meaningful text, use any of the following approaches:
Use Update-Type
Update-Type
tells PowerShell how to interpret the property. This command needs to be executed only once per PowerShell session:
Update-TypeData -MemberName ForegroundApplicationBoost -TypeName "Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem" -MemberType ScriptProperty -Value {
Enum EnumForegroundApplicationBoost
{
None = 0
Minimum = 1
Maximum = 2
}
[EnumForegroundApplicationBoost]($this.PSBase.CimInstanceProperties['ForegroundApplicationBoost'].Value)
} -Force
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property ForegroundApplicationBoost
Use Select-Object
Select-Object
supports calculated properties. When you submit a hashtable, PowerShell dynamically calculates the result:
$ForegroundApplicationBoost = @{
Name = 'ForegroundApplicationBoostText'
Expression = {
$value = $_.ForegroundApplicationBoost
switch([int]$value)
{
0 {'None'}
1 {'Minimum'}
2 {'Maximum'}
default {"$value"}
}
}
}
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Caption, ForegroundApplicationBoost, $ForegroundApplicationBoost
Use a PowerShell Hashtable
You can use a PowerShell hashtable to decode numeric values. Use a hashtable like this one:
$ForegroundApplicationBoost_map = @{
0 = 'None'
1 = 'Minimum'
2 = 'Maximum'
}
Use Enum structure
You can cast the raw property values to a new enum type to translate raw numeric values into friendly text. Use an enum like this one:
Enum EnumForegroundApplicationBoost
{
None = 0
Minimum = 1
Maximum = 2
}
FreePhysicalMemory
Number, in kilobytes, of physical memory currently unused and available.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property FreePhysicalMemory
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty FreePhysicalMemory
"FreePhysicalMemory = ${value} kilobytes"
'FreePhysicalMemory = {0:n1} GB' -f ($value/1MB)
You can update the PowerShell type database to automatically convert the raw property value. This example illustrates overwriting ToString() method to provide formatted output while leaving the original property value untouched:
# outputting raw value:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty FreePhysicalMemory
# updating type database (needs to be done only once per PowerShell session)
# this command instructs PowerShell to overwrite the method ToString() and automatically divide the raw value and transform it in a different unit:
Update-TypeData -MemberName FreePhysicalMemory -TypeName 'Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem' -MemberType ScriptProperty -Value { ($this.PSBase.CimInstanceProperties['FreePhysicalMemory'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru } -Force
# compare the results of the identical command.
# raw values are now automatically transformed into a more meaningful unit:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty FreePhysicalMemory
FreeSpaceInPagingFiles
Number, in kilobytes, that can be mapped into the operating system paging files without causing any other pages to be swapped out.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property FreeSpaceInPagingFiles
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty FreeSpaceInPagingFiles
"FreeSpaceInPagingFiles = ${value} kilobytes"
'FreeSpaceInPagingFiles = {0:n1} GB' -f ($value/1MB)
You can update the PowerShell type database to automatically convert the raw property value. This example illustrates overwriting ToString() method to provide formatted output while leaving the original property value untouched:
# outputting raw value:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty FreeSpaceInPagingFiles
# updating type database (needs to be done only once per PowerShell session)
# this command instructs PowerShell to overwrite the method ToString() and automatically divide the raw value and transform it in a different unit:
Update-TypeData -MemberName FreeSpaceInPagingFiles -TypeName 'Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem' -MemberType ScriptProperty -Value { ($this.PSBase.CimInstanceProperties['FreeSpaceInPagingFiles'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru } -Force
# compare the results of the identical command.
# raw values are now automatically transformed into a more meaningful unit:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty FreeSpaceInPagingFiles
FreeVirtualMemory
Number, in kilobytes, of virtual memory currently unused and available.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property FreeVirtualMemory
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty FreeVirtualMemory
"FreeVirtualMemory = ${value} kilobytes"
'FreeVirtualMemory = {0:n1} GB' -f ($value/1MB)
You can update the PowerShell type database to automatically convert the raw property value. This example illustrates overwriting ToString() method to provide formatted output while leaving the original property value untouched:
# outputting raw value:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty FreeVirtualMemory
# updating type database (needs to be done only once per PowerShell session)
# this command instructs PowerShell to overwrite the method ToString() and automatically divide the raw value and transform it in a different unit:
Update-TypeData -MemberName FreeVirtualMemory -TypeName 'Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem' -MemberType ScriptProperty -Value { ($this.PSBase.CimInstanceProperties['FreeVirtualMemory'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru } -Force
# compare the results of the identical command.
# raw values are now automatically transformed into a more meaningful unit:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty FreeVirtualMemory
InstallDate
Date object was installed. This property does not require a value to indicate that the object is installed.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property InstallDate
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty InstallDate
"InstallDate = $value"
# calculating the passed days:
$timeDifference = New-TimeSpan -Start $value
$days = $timeDifference.Days
"InstallDate days passed: $days"
LastBootUpTime
Date and time the operating system was last restarted.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property LastBootUpTime
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty LastBootUpTime
"LastBootUpTime = $value"
# calculating the passed days:
$timeDifference = New-TimeSpan -Start $value
$days = $timeDifference.Days
"LastBootUpTime days passed: $days"
LocalDateTime
Operating system version of the local date and time-of-day.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property LocalDateTime
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty LocalDateTime
"LocalDateTime = $value"
# calculating the passed days:
$timeDifference = New-TimeSpan -Start $value
$days = $timeDifference.Days
"LocalDateTime days passed: $days"
Locale
Hexadecimal language identifier used by the operating system. Can be converted to a CultureInfo object. Example: [System.Globalization.CultureInfo]0x0407
.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Locale
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty Locale
"Locale = $value"
You can update the PowerShell type database to automatically convert the raw property value. This example illustrates converting raw content to a better .NET type:
# outputting raw value:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty Locale
# updating type database (needs to be done only once per PowerShell session)
# this command instructs PowerShell to automatically convert the property to a different type:
Update-TypeData -MemberName Locale -TypeName 'Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem' -MemberType ScriptProperty -Value { [System.Globalization.CultureInfo][Convert]::ToInt32(($this.PSBase.CimInstanceProperties['Locale'].Value),16) } -Force
# compare the results of the identical command.
# raw values are now automatically converted to a more suitable .NET type:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty Locale
Manufacturer
Name of the operating system manufacturer. For Windows-based systems, this value is “Microsoft Corporation”.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Manufacturer
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty Manufacturer
"Manufacturer = $value"
MaxNumberOfProcesses
Maximum number of process contexts the operating system can support. The default value set by the provider is 4294967295 (0xFFFFFFFF). If there is no fixed maximum, the value should be 0 (zero). On systems that have a fixed maximum, this object can help diagnose failures that occur when the maximum is reached. If unknown, enter 4294967295 (0xFFFFFFFF).
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property MaxNumberOfProcesses
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty MaxNumberOfProcesses
"MaxNumberOfProcesses = $value"
MaxProcessMemorySize
Maximum number, in kilobytes, of memory that can be allocated to a process. For operating systems with no virtual memory, typically this value is equal to the total amount of physical memory minus the memory used by the BIOS and the operating system. For some operating systems, this value may be infinity, in which case 0 (zero) should be entered. In other cases, this value could be a constant, for example, 2G or 4G.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property MaxProcessMemorySize
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty MaxProcessMemorySize
"MaxProcessMemorySize = ${value} kilobytes"
'MaxProcessMemorySize = {0:n1} GB' -f ($value/1MB)
You can update the PowerShell type database to automatically convert the raw property value. This example illustrates overwriting ToString() method to provide formatted output while leaving the original property value untouched:
# outputting raw value:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty MaxProcessMemorySize
# updating type database (needs to be done only once per PowerShell session)
# this command instructs PowerShell to overwrite the method ToString() and automatically divide the raw value and transform it in a different unit:
Update-TypeData -MemberName MaxProcessMemorySize -TypeName 'Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem' -MemberType ScriptProperty -Value { ($this.PSBase.CimInstanceProperties['MaxProcessMemorySize'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru } -Force
# compare the results of the identical command.
# raw values are now automatically transformed into a more meaningful unit:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty MaxProcessMemorySize
MUILanguages
Multilingual User Interface Pack (MUI Pack ) languages installed on the computer. For example, “en-us”. MUI Pack languages are resource files that can be installed on the English version of the operating system. When an MUI Pack is installed, you can can change the user interface language to one of 33 supported languages.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property MUILanguages
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty MUILanguages
"MUILanguages = $value"
Name
Operating system instance within a computer system.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Name
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty Name
"Name = $value"
NumberOfLicensedUsers
Number of user licenses for the operating system. If unlimited, enter 0 (zero). If unknown, enter -1.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property NumberOfLicensedUsers
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty NumberOfLicensedUsers
"NumberOfLicensedUsers = $value"
NumberOfProcesses
Number of process contexts currently loaded or running on the operating system.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property NumberOfProcesses
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty NumberOfProcesses
"NumberOfProcesses = $value"
NumberOfUsers
Number of user sessions for which the operating system is storing state information currently.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property NumberOfUsers
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty NumberOfUsers
"NumberOfUsers = $value"
OperatingSystemSKU
Stock Keeping Unit (SKU) number for the operating system. These values are the same as the PRODUCT_* constants defined in WinNT.h that are used with the GetProductInfo function.
OperatingSystemSKU returns a numeric value. To translate it into a meaningful text, use any of the following approaches:
Use Update-Type
Update-Type
tells PowerShell how to interpret the property. This command needs to be executed only once per PowerShell session:
Update-TypeData -MemberName OperatingSystemSKU -TypeName "Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem" -MemberType ScriptProperty -Value {
Enum EnumOperatingSystemSKU
{
PRODUCT_UNDEFINED = 0
PRODUCT_ULTIMATE = 1
PRODUCT_HOME_BASIC = 2
PRODUCT_HOME_PREMIUM = 3
PRODUCT_ENTERPRISE = 4
PRODUCT_HOME_BASIC_N = 5
PRODUCT_BUSINESS = 6
PRODUCT_STANDARD_SERVER = 7
PRODUCT_DATACENTER_SERVER = 8
PRODUCT_SMALLBUSINESS_SERVER = 9
PRODUCT_ENTERPRISE_SERVER = 10
PRODUCT_STARTER = 11
PRODUCT_DATACENTER_SERVER_CORE = 12
PRODUCT_STANDARD_SERVER_CORE = 13
PRODUCT_ENTERPRISE_SERVER_CORE = 14
PRODUCT_ENTERPRISE_SERVER_IA64 = 15
PRODUCT_BUSINESS_N = 16
PRODUCT_WEB_SERVER = 17
PRODUCT_CLUSTER_SERVER = 18
PRODUCT_HOME_SERVER = 19
PRODUCT_STORAGE_EXPRESS_SERVER = 20
PRODUCT_STORAGE_STANDARD_SERVER = 21
PRODUCT_STORAGE_WORKGROUP_SERVER = 22
PRODUCT_STORAGE_ENTERPRISE_SERVER = 23
PRODUCT_SERVER_FOR_SMALLBUSINESS = 24
PRODUCT_SMALLBUSINESS_SERVER_PREMIUM = 25
PRODUCT_HOME_PREMIUM_N = 26
PRODUCT_ENTERPRISE_N = 27
PRODUCT_ULTIMATE_N = 28
PRODUCT_WEB_SERVER_CORE = 29
PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT = 30
PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY = 31
PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING = 32
PRODUCT_SERVER_FOUNDATION = 33
PRODUCT_HOME_PREMIUM_SERVER = 34
PRODUCT_SERVER_FOR_SMALLBUSINESS_V = 35
PRODUCT_STANDARD_SERVER_V = 36
PRODUCT_DATACENTER_SERVER_V = 37
PRODUCT_ENTERPRISE_SERVER_V = 38
PRODUCT_DATACENTER_SERVER_CORE_V = 39
PRODUCT_STANDARD_SERVER_CORE_V = 40
PRODUCT_ENTERPRISE_SERVER_CORE_V = 41
PRODUCT_HYPERV = 42
PRODUCT_STORAGE_EXPRESS_SERVER_CORE = 43
PRODUCT_STORAGE_STANDARD_SERVER_CORE = 44
PRODUCT_STORAGE_WORKGROUP_SERVER_CORE = 45
PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE = 46
PRODUCT_STARTER_N = 47
PRODUCT_PROFESSIONAL = 48
PRODUCT_PROFESSIONAL_N = 49
PRODUCT_SB_SOLUTION_SERVER = 50
PRODUCT_SERVER_FOR_SB_SOLUTIONS = 51
PRODUCT_STANDARD_SERVER_SOLUTIONS = 52
PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE = 53
PRODUCT_SB_SOLUTION_SERVER_EM = 54
PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM = 55
PRODUCT_SOLUTION_EMBEDDEDSERVER = 56
PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE = 57
PRODUCT_PROFESSIONAL_EMBEDDED = 58
PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT = 59
PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL = 60
PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC = 61
PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC = 62
PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE = 63
PRODUCT_CLUSTER_SERVER_V = 64
PRODUCT_EMBEDDED = 65
PRODUCT_STARTER_E = 66
PRODUCT_HOME_BASIC_E = 67
PRODUCT_HOME_PREMIUM_E = 68
PRODUCT_PROFESSIONAL_E = 69
PRODUCT_ENTERPRISE_E = 70
PRODUCT_ULTIMATE_E = 71
PRODUCT_ENTERPRISE_EVALUATION = 72
PRODUCT_MULTIPOINT_STANDARD_SERVER = 76
PRODUCT_MULTIPOINT_PREMIUM_SERVER = 77
PRODUCT_STANDARD_EVALUATION_SERVER = 79
PRODUCT_DATACENTER_EVALUATION_SERVER = 80
PRODUCT_ENTERPRISE_N_EVALUATION = 84
PRODUCT_EMBEDDED_AUTOMOTIVE = 85
PRODUCT_EMBEDDED_INDUSTRY_A = 86
PRODUCT_THINPC = 87
PRODUCT_EMBEDDED_A = 88
PRODUCT_EMBEDDED_INDUSTRY = 89
PRODUCT_EMBEDDED_E = 90
PRODUCT_EMBEDDED_INDUSTRY_E = 91
PRODUCT_EMBEDDED_INDUSTRY_A_E = 92
PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVE = 95
PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER = 96
PRODUCT_CORE_ARM = 97
PRODUCT_CORE_N = 98
PRODUCT_CORE_COUNTRYSPECIFIC = 99
PRODUCT_CORE_SINGLELANGUAGE = 100
PRODUCT_CORE = 101
PRODUCT_PROFESSIONAL_WMC = 103
PRODUCT_EMBEDDED_INDUSTRY_EVAL = 105
PRODUCT_EMBEDDED_INDUSTRY_E_EVAL = 106
PRODUCT_EMBEDDED_EVAL = 107
PRODUCT_EMBEDDED_E_EVAL = 108
PRODUCT_NANO_SERVER = 109
PRODUCT_CLOUD_STORAGE_SERVER = 110
PRODUCT_CORE_CONNECTED = 111
PRODUCT_PROFESSIONAL_STUDENT = 112
PRODUCT_CORE_CONNECTED_N = 113
PRODUCT_PROFESSIONAL_STUDENT_N = 114
PRODUCT_CORE_CONNECTED_SINGLELANGUAGE = 115
PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC = 116
PRODUCT_CONNECTED_CAR = 117
PRODUCT_INDUSTRY_HANDHELD = 118
PRODUCT_PPI_PRO = 119
PRODUCT_ARM64_SERVER = 120
PRODUCT_EDUCATION = 121
PRODUCT_EDUCATION_N = 122
PRODUCT_IOTUAP = 123
PRODUCT_CLOUD_HOST_INFRASTRUCTURE_SERVER = 124
PRODUCT_ENTERPRISE_S = 125
PRODUCT_ENTERPRISE_S_N = 126
PRODUCT_PROFESSIONAL_S = 127
PRODUCT_PROFESSIONAL_S_N = 128
PRODUCT_ENTERPRISE_S_EVALUATION = 129
PRODUCT_ENTERPRISE_S_N_EVALUATION = 130
PRODUCT_HOLOGRAPHIC = 135
PRODUCT_PRO_SINGLE_LANGUAGE = 138
PRODUCT_PRO_CHINA = 139
PRODUCT_ENTERPRISE_SUBSCRIPTION = 140
PRODUCT_ENTERPRISE_SUBSCRIPTION_N = 141
PRODUCT_DATACENTER_NANO_SERVER = 143
PRODUCT_STANDARD_NANO_SERVER = 144
PRODUCT_DATACENTER_A_SERVER_CORE = 145
PRODUCT_STANDARD_A_SERVER_CORE = 146
PRODUCT_DATACENTER_WS_SERVER_CORE = 147
PRODUCT_STANDARD_WS_SERVER_CORE = 148
PRODUCT_UTILITY_VM = 149
PRODUCT_DATACENTER_EVALUATION_SERVER_CORE = 159
PRODUCT_STANDARD_EVALUATION_SERVER_CORE = 160
PRODUCT_PRO_WORKSTATION = 161
PRODUCT_PRO_WORKSTATION_N = 162
PRODUCT_PRO_FOR_EDUCATION = 164
PRODUCT_PRO_FOR_EDUCATION_N = 165
PRODUCT_AZURE_SERVER_CORE = 168
PRODUCT_AZURE_NANO_SERVER = 169
PRODUCT_ENTERPRISEG = 171
PRODUCT_ENTERPRISEGN = 172
PRODUCT_SERVERRDSH = 175
PRODUCT_CLOUD = 178
PRODUCT_CLOUDN = 179
PRODUCT_HUBOS = 180
PRODUCT_ONECOREUPDATEOS = 182
PRODUCT_CLOUDE = 183
PRODUCT_ANDROMEDA = 184
PRODUCT_IOTOS = 185
PRODUCT_CLOUDEN = 186
}
[EnumOperatingSystemSKU]($this.PSBase.CimInstanceProperties['OperatingSystemSKU'].Value)
} -Force
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property OperatingSystemSKU
Use Select-Object
Select-Object
supports calculated properties. When you submit a hashtable, PowerShell dynamically calculates the result:
$OperatingSystemSKU = @{
Name = 'OperatingSystemSKUText'
Expression = {
$value = $_.OperatingSystemSKU
switch([int]$value)
{
0 {'PRODUCT_UNDEFINED'}
1 {'PRODUCT_ULTIMATE'}
2 {'PRODUCT_HOME_BASIC'}
3 {'PRODUCT_HOME_PREMIUM'}
4 {'PRODUCT_ENTERPRISE'}
5 {'PRODUCT_HOME_BASIC_N'}
6 {'PRODUCT_BUSINESS'}
7 {'PRODUCT_STANDARD_SERVER'}
8 {'PRODUCT_DATACENTER_SERVER'}
9 {'PRODUCT_SMALLBUSINESS_SERVER'}
10 {'PRODUCT_ENTERPRISE_SERVER'}
11 {'PRODUCT_STARTER'}
12 {'PRODUCT_DATACENTER_SERVER_CORE'}
13 {'PRODUCT_STANDARD_SERVER_CORE'}
14 {'PRODUCT_ENTERPRISE_SERVER_CORE'}
15 {'PRODUCT_ENTERPRISE_SERVER_IA64'}
16 {'PRODUCT_BUSINESS_N'}
17 {'PRODUCT_WEB_SERVER'}
18 {'PRODUCT_CLUSTER_SERVER'}
19 {'PRODUCT_HOME_SERVER'}
20 {'PRODUCT_STORAGE_EXPRESS_SERVER'}
21 {'PRODUCT_STORAGE_STANDARD_SERVER'}
22 {'PRODUCT_STORAGE_WORKGROUP_SERVER'}
23 {'PRODUCT_STORAGE_ENTERPRISE_SERVER'}
24 {'PRODUCT_SERVER_FOR_SMALLBUSINESS'}
25 {'PRODUCT_SMALLBUSINESS_SERVER_PREMIUM'}
26 {'PRODUCT_HOME_PREMIUM_N'}
27 {'PRODUCT_ENTERPRISE_N'}
28 {'PRODUCT_ULTIMATE_N'}
29 {'PRODUCT_WEB_SERVER_CORE'}
30 {'PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT'}
31 {'PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY'}
32 {'PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING'}
33 {'PRODUCT_SERVER_FOUNDATION'}
34 {'PRODUCT_HOME_PREMIUM_SERVER'}
35 {'PRODUCT_SERVER_FOR_SMALLBUSINESS_V'}
36 {'PRODUCT_STANDARD_SERVER_V'}
37 {'PRODUCT_DATACENTER_SERVER_V'}
38 {'PRODUCT_ENTERPRISE_SERVER_V'}
39 {'PRODUCT_DATACENTER_SERVER_CORE_V'}
40 {'PRODUCT_STANDARD_SERVER_CORE_V'}
41 {'PRODUCT_ENTERPRISE_SERVER_CORE_V'}
42 {'PRODUCT_HYPERV'}
43 {'PRODUCT_STORAGE_EXPRESS_SERVER_CORE'}
44 {'PRODUCT_STORAGE_STANDARD_SERVER_CORE'}
45 {'PRODUCT_STORAGE_WORKGROUP_SERVER_CORE'}
46 {'PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE'}
47 {'PRODUCT_STARTER_N'}
48 {'PRODUCT_PROFESSIONAL'}
49 {'PRODUCT_PROFESSIONAL_N'}
50 {'PRODUCT_SB_SOLUTION_SERVER'}
51 {'PRODUCT_SERVER_FOR_SB_SOLUTIONS'}
52 {'PRODUCT_STANDARD_SERVER_SOLUTIONS'}
53 {'PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE'}
54 {'PRODUCT_SB_SOLUTION_SERVER_EM'}
55 {'PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM'}
56 {'PRODUCT_SOLUTION_EMBEDDEDSERVER'}
57 {'PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE'}
58 {'PRODUCT_PROFESSIONAL_EMBEDDED'}
59 {'PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT'}
60 {'PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL'}
61 {'PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC'}
62 {'PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC'}
63 {'PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE'}
64 {'PRODUCT_CLUSTER_SERVER_V'}
65 {'PRODUCT_EMBEDDED'}
66 {'PRODUCT_STARTER_E'}
67 {'PRODUCT_HOME_BASIC_E'}
68 {'PRODUCT_HOME_PREMIUM_E'}
69 {'PRODUCT_PROFESSIONAL_E'}
70 {'PRODUCT_ENTERPRISE_E'}
71 {'PRODUCT_ULTIMATE_E'}
72 {'PRODUCT_ENTERPRISE_EVALUATION'}
76 {'PRODUCT_MULTIPOINT_STANDARD_SERVER'}
77 {'PRODUCT_MULTIPOINT_PREMIUM_SERVER'}
79 {'PRODUCT_STANDARD_EVALUATION_SERVER'}
80 {'PRODUCT_DATACENTER_EVALUATION_SERVER'}
84 {'PRODUCT_ENTERPRISE_N_EVALUATION'}
85 {'PRODUCT_EMBEDDED_AUTOMOTIVE'}
86 {'PRODUCT_EMBEDDED_INDUSTRY_A'}
87 {'PRODUCT_THINPC'}
88 {'PRODUCT_EMBEDDED_A'}
89 {'PRODUCT_EMBEDDED_INDUSTRY'}
90 {'PRODUCT_EMBEDDED_E'}
91 {'PRODUCT_EMBEDDED_INDUSTRY_E'}
92 {'PRODUCT_EMBEDDED_INDUSTRY_A_E'}
95 {'PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVE'}
96 {'PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER'}
97 {'PRODUCT_CORE_ARM'}
98 {'PRODUCT_CORE_N'}
99 {'PRODUCT_CORE_COUNTRYSPECIFIC'}
100 {'PRODUCT_CORE_SINGLELANGUAGE'}
101 {'PRODUCT_CORE'}
103 {'PRODUCT_PROFESSIONAL_WMC'}
105 {'PRODUCT_EMBEDDED_INDUSTRY_EVAL'}
106 {'PRODUCT_EMBEDDED_INDUSTRY_E_EVAL'}
107 {'PRODUCT_EMBEDDED_EVAL'}
108 {'PRODUCT_EMBEDDED_E_EVAL'}
109 {'PRODUCT_NANO_SERVER'}
110 {'PRODUCT_CLOUD_STORAGE_SERVER'}
111 {'PRODUCT_CORE_CONNECTED'}
112 {'PRODUCT_PROFESSIONAL_STUDENT'}
113 {'PRODUCT_CORE_CONNECTED_N'}
114 {'PRODUCT_PROFESSIONAL_STUDENT_N'}
115 {'PRODUCT_CORE_CONNECTED_SINGLELANGUAGE'}
116 {'PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC'}
117 {'PRODUCT_CONNECTED_CAR'}
118 {'PRODUCT_INDUSTRY_HANDHELD'}
119 {'PRODUCT_PPI_PRO'}
120 {'PRODUCT_ARM64_SERVER'}
121 {'PRODUCT_EDUCATION'}
122 {'PRODUCT_EDUCATION_N'}
123 {'PRODUCT_IOTUAP'}
124 {'PRODUCT_CLOUD_HOST_INFRASTRUCTURE_SERVER'}
125 {'PRODUCT_ENTERPRISE_S'}
126 {'PRODUCT_ENTERPRISE_S_N'}
127 {'PRODUCT_PROFESSIONAL_S'}
128 {'PRODUCT_PROFESSIONAL_S_N'}
129 {'PRODUCT_ENTERPRISE_S_EVALUATION'}
130 {'PRODUCT_ENTERPRISE_S_N_EVALUATION'}
135 {'PRODUCT_HOLOGRAPHIC'}
138 {'PRODUCT_PRO_SINGLE_LANGUAGE'}
139 {'PRODUCT_PRO_CHINA'}
140 {'PRODUCT_ENTERPRISE_SUBSCRIPTION'}
141 {'PRODUCT_ENTERPRISE_SUBSCRIPTION_N'}
143 {'PRODUCT_DATACENTER_NANO_SERVER'}
144 {'PRODUCT_STANDARD_NANO_SERVER'}
145 {'PRODUCT_DATACENTER_A_SERVER_CORE'}
146 {'PRODUCT_STANDARD_A_SERVER_CORE'}
147 {'PRODUCT_DATACENTER_WS_SERVER_CORE'}
148 {'PRODUCT_STANDARD_WS_SERVER_CORE'}
149 {'PRODUCT_UTILITY_VM'}
159 {'PRODUCT_DATACENTER_EVALUATION_SERVER_CORE'}
160 {'PRODUCT_STANDARD_EVALUATION_SERVER_CORE'}
161 {'PRODUCT_PRO_WORKSTATION'}
162 {'PRODUCT_PRO_WORKSTATION_N'}
164 {'PRODUCT_PRO_FOR_EDUCATION'}
165 {'PRODUCT_PRO_FOR_EDUCATION_N'}
168 {'PRODUCT_AZURE_SERVER_CORE'}
169 {'PRODUCT_AZURE_NANO_SERVER'}
171 {'PRODUCT_ENTERPRISEG'}
172 {'PRODUCT_ENTERPRISEGN'}
175 {'PRODUCT_SERVERRDSH'}
178 {'PRODUCT_CLOUD'}
179 {'PRODUCT_CLOUDN'}
180 {'PRODUCT_HUBOS'}
182 {'PRODUCT_ONECOREUPDATEOS'}
183 {'PRODUCT_CLOUDE'}
184 {'PRODUCT_ANDROMEDA'}
185 {'PRODUCT_IOTOS'}
186 {'PRODUCT_CLOUDEN'}
default {"$value"}
}
}
}
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Caption, OperatingSystemSKU, $OperatingSystemSKU
Use a PowerShell Hashtable
You can use a PowerShell hashtable to decode numeric values. Use a hashtable like this one:
$OperatingSystemSKU_map = @{
0 = 'PRODUCT_UNDEFINED'
1 = 'PRODUCT_ULTIMATE'
2 = 'PRODUCT_HOME_BASIC'
3 = 'PRODUCT_HOME_PREMIUM'
4 = 'PRODUCT_ENTERPRISE'
5 = 'PRODUCT_HOME_BASIC_N'
6 = 'PRODUCT_BUSINESS'
7 = 'PRODUCT_STANDARD_SERVER'
8 = 'PRODUCT_DATACENTER_SERVER'
9 = 'PRODUCT_SMALLBUSINESS_SERVER'
10 = 'PRODUCT_ENTERPRISE_SERVER'
11 = 'PRODUCT_STARTER'
12 = 'PRODUCT_DATACENTER_SERVER_CORE'
13 = 'PRODUCT_STANDARD_SERVER_CORE'
14 = 'PRODUCT_ENTERPRISE_SERVER_CORE'
15 = 'PRODUCT_ENTERPRISE_SERVER_IA64'
16 = 'PRODUCT_BUSINESS_N'
17 = 'PRODUCT_WEB_SERVER'
18 = 'PRODUCT_CLUSTER_SERVER'
19 = 'PRODUCT_HOME_SERVER'
20 = 'PRODUCT_STORAGE_EXPRESS_SERVER'
21 = 'PRODUCT_STORAGE_STANDARD_SERVER'
22 = 'PRODUCT_STORAGE_WORKGROUP_SERVER'
23 = 'PRODUCT_STORAGE_ENTERPRISE_SERVER'
24 = 'PRODUCT_SERVER_FOR_SMALLBUSINESS'
25 = 'PRODUCT_SMALLBUSINESS_SERVER_PREMIUM'
26 = 'PRODUCT_HOME_PREMIUM_N'
27 = 'PRODUCT_ENTERPRISE_N'
28 = 'PRODUCT_ULTIMATE_N'
29 = 'PRODUCT_WEB_SERVER_CORE'
30 = 'PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT'
31 = 'PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY'
32 = 'PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING'
33 = 'PRODUCT_SERVER_FOUNDATION'
34 = 'PRODUCT_HOME_PREMIUM_SERVER'
35 = 'PRODUCT_SERVER_FOR_SMALLBUSINESS_V'
36 = 'PRODUCT_STANDARD_SERVER_V'
37 = 'PRODUCT_DATACENTER_SERVER_V'
38 = 'PRODUCT_ENTERPRISE_SERVER_V'
39 = 'PRODUCT_DATACENTER_SERVER_CORE_V'
40 = 'PRODUCT_STANDARD_SERVER_CORE_V'
41 = 'PRODUCT_ENTERPRISE_SERVER_CORE_V'
42 = 'PRODUCT_HYPERV'
43 = 'PRODUCT_STORAGE_EXPRESS_SERVER_CORE'
44 = 'PRODUCT_STORAGE_STANDARD_SERVER_CORE'
45 = 'PRODUCT_STORAGE_WORKGROUP_SERVER_CORE'
46 = 'PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE'
47 = 'PRODUCT_STARTER_N'
48 = 'PRODUCT_PROFESSIONAL'
49 = 'PRODUCT_PROFESSIONAL_N'
50 = 'PRODUCT_SB_SOLUTION_SERVER'
51 = 'PRODUCT_SERVER_FOR_SB_SOLUTIONS'
52 = 'PRODUCT_STANDARD_SERVER_SOLUTIONS'
53 = 'PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE'
54 = 'PRODUCT_SB_SOLUTION_SERVER_EM'
55 = 'PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM'
56 = 'PRODUCT_SOLUTION_EMBEDDEDSERVER'
57 = 'PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE'
58 = 'PRODUCT_PROFESSIONAL_EMBEDDED'
59 = 'PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT'
60 = 'PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL'
61 = 'PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC'
62 = 'PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC'
63 = 'PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE'
64 = 'PRODUCT_CLUSTER_SERVER_V'
65 = 'PRODUCT_EMBEDDED'
66 = 'PRODUCT_STARTER_E'
67 = 'PRODUCT_HOME_BASIC_E'
68 = 'PRODUCT_HOME_PREMIUM_E'
69 = 'PRODUCT_PROFESSIONAL_E'
70 = 'PRODUCT_ENTERPRISE_E'
71 = 'PRODUCT_ULTIMATE_E'
72 = 'PRODUCT_ENTERPRISE_EVALUATION'
76 = 'PRODUCT_MULTIPOINT_STANDARD_SERVER'
77 = 'PRODUCT_MULTIPOINT_PREMIUM_SERVER'
79 = 'PRODUCT_STANDARD_EVALUATION_SERVER'
80 = 'PRODUCT_DATACENTER_EVALUATION_SERVER'
84 = 'PRODUCT_ENTERPRISE_N_EVALUATION'
85 = 'PRODUCT_EMBEDDED_AUTOMOTIVE'
86 = 'PRODUCT_EMBEDDED_INDUSTRY_A'
87 = 'PRODUCT_THINPC'
88 = 'PRODUCT_EMBEDDED_A'
89 = 'PRODUCT_EMBEDDED_INDUSTRY'
90 = 'PRODUCT_EMBEDDED_E'
91 = 'PRODUCT_EMBEDDED_INDUSTRY_E'
92 = 'PRODUCT_EMBEDDED_INDUSTRY_A_E'
95 = 'PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVE'
96 = 'PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER'
97 = 'PRODUCT_CORE_ARM'
98 = 'PRODUCT_CORE_N'
99 = 'PRODUCT_CORE_COUNTRYSPECIFIC'
100 = 'PRODUCT_CORE_SINGLELANGUAGE'
101 = 'PRODUCT_CORE'
103 = 'PRODUCT_PROFESSIONAL_WMC'
105 = 'PRODUCT_EMBEDDED_INDUSTRY_EVAL'
106 = 'PRODUCT_EMBEDDED_INDUSTRY_E_EVAL'
107 = 'PRODUCT_EMBEDDED_EVAL'
108 = 'PRODUCT_EMBEDDED_E_EVAL'
109 = 'PRODUCT_NANO_SERVER'
110 = 'PRODUCT_CLOUD_STORAGE_SERVER'
111 = 'PRODUCT_CORE_CONNECTED'
112 = 'PRODUCT_PROFESSIONAL_STUDENT'
113 = 'PRODUCT_CORE_CONNECTED_N'
114 = 'PRODUCT_PROFESSIONAL_STUDENT_N'
115 = 'PRODUCT_CORE_CONNECTED_SINGLELANGUAGE'
116 = 'PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC'
117 = 'PRODUCT_CONNECTED_CAR'
118 = 'PRODUCT_INDUSTRY_HANDHELD'
119 = 'PRODUCT_PPI_PRO'
120 = 'PRODUCT_ARM64_SERVER'
121 = 'PRODUCT_EDUCATION'
122 = 'PRODUCT_EDUCATION_N'
123 = 'PRODUCT_IOTUAP'
124 = 'PRODUCT_CLOUD_HOST_INFRASTRUCTURE_SERVER'
125 = 'PRODUCT_ENTERPRISE_S'
126 = 'PRODUCT_ENTERPRISE_S_N'
127 = 'PRODUCT_PROFESSIONAL_S'
128 = 'PRODUCT_PROFESSIONAL_S_N'
129 = 'PRODUCT_ENTERPRISE_S_EVALUATION'
130 = 'PRODUCT_ENTERPRISE_S_N_EVALUATION'
135 = 'PRODUCT_HOLOGRAPHIC'
138 = 'PRODUCT_PRO_SINGLE_LANGUAGE'
139 = 'PRODUCT_PRO_CHINA'
140 = 'PRODUCT_ENTERPRISE_SUBSCRIPTION'
141 = 'PRODUCT_ENTERPRISE_SUBSCRIPTION_N'
143 = 'PRODUCT_DATACENTER_NANO_SERVER'
144 = 'PRODUCT_STANDARD_NANO_SERVER'
145 = 'PRODUCT_DATACENTER_A_SERVER_CORE'
146 = 'PRODUCT_STANDARD_A_SERVER_CORE'
147 = 'PRODUCT_DATACENTER_WS_SERVER_CORE'
148 = 'PRODUCT_STANDARD_WS_SERVER_CORE'
149 = 'PRODUCT_UTILITY_VM'
159 = 'PRODUCT_DATACENTER_EVALUATION_SERVER_CORE'
160 = 'PRODUCT_STANDARD_EVALUATION_SERVER_CORE'
161 = 'PRODUCT_PRO_WORKSTATION'
162 = 'PRODUCT_PRO_WORKSTATION_N'
164 = 'PRODUCT_PRO_FOR_EDUCATION'
165 = 'PRODUCT_PRO_FOR_EDUCATION_N'
168 = 'PRODUCT_AZURE_SERVER_CORE'
169 = 'PRODUCT_AZURE_NANO_SERVER'
171 = 'PRODUCT_ENTERPRISEG'
172 = 'PRODUCT_ENTERPRISEGN'
175 = 'PRODUCT_SERVERRDSH'
178 = 'PRODUCT_CLOUD'
179 = 'PRODUCT_CLOUDN'
180 = 'PRODUCT_HUBOS'
182 = 'PRODUCT_ONECOREUPDATEOS'
183 = 'PRODUCT_CLOUDE'
184 = 'PRODUCT_ANDROMEDA'
185 = 'PRODUCT_IOTOS'
186 = 'PRODUCT_CLOUDEN'
}
Use Enum structure
You can cast the raw property values to a new enum type to translate raw numeric values into friendly text. Use an enum like this one:
Enum EnumOperatingSystemSKU
{
PRODUCT_UNDEFINED = 0
PRODUCT_ULTIMATE = 1
PRODUCT_HOME_BASIC = 2
PRODUCT_HOME_PREMIUM = 3
PRODUCT_ENTERPRISE = 4
PRODUCT_HOME_BASIC_N = 5
PRODUCT_BUSINESS = 6
PRODUCT_STANDARD_SERVER = 7
PRODUCT_DATACENTER_SERVER = 8
PRODUCT_SMALLBUSINESS_SERVER = 9
PRODUCT_ENTERPRISE_SERVER = 10
PRODUCT_STARTER = 11
PRODUCT_DATACENTER_SERVER_CORE = 12
PRODUCT_STANDARD_SERVER_CORE = 13
PRODUCT_ENTERPRISE_SERVER_CORE = 14
PRODUCT_ENTERPRISE_SERVER_IA64 = 15
PRODUCT_BUSINESS_N = 16
PRODUCT_WEB_SERVER = 17
PRODUCT_CLUSTER_SERVER = 18
PRODUCT_HOME_SERVER = 19
PRODUCT_STORAGE_EXPRESS_SERVER = 20
PRODUCT_STORAGE_STANDARD_SERVER = 21
PRODUCT_STORAGE_WORKGROUP_SERVER = 22
PRODUCT_STORAGE_ENTERPRISE_SERVER = 23
PRODUCT_SERVER_FOR_SMALLBUSINESS = 24
PRODUCT_SMALLBUSINESS_SERVER_PREMIUM = 25
PRODUCT_HOME_PREMIUM_N = 26
PRODUCT_ENTERPRISE_N = 27
PRODUCT_ULTIMATE_N = 28
PRODUCT_WEB_SERVER_CORE = 29
PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT = 30
PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY = 31
PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING = 32
PRODUCT_SERVER_FOUNDATION = 33
PRODUCT_HOME_PREMIUM_SERVER = 34
PRODUCT_SERVER_FOR_SMALLBUSINESS_V = 35
PRODUCT_STANDARD_SERVER_V = 36
PRODUCT_DATACENTER_SERVER_V = 37
PRODUCT_ENTERPRISE_SERVER_V = 38
PRODUCT_DATACENTER_SERVER_CORE_V = 39
PRODUCT_STANDARD_SERVER_CORE_V = 40
PRODUCT_ENTERPRISE_SERVER_CORE_V = 41
PRODUCT_HYPERV = 42
PRODUCT_STORAGE_EXPRESS_SERVER_CORE = 43
PRODUCT_STORAGE_STANDARD_SERVER_CORE = 44
PRODUCT_STORAGE_WORKGROUP_SERVER_CORE = 45
PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE = 46
PRODUCT_STARTER_N = 47
PRODUCT_PROFESSIONAL = 48
PRODUCT_PROFESSIONAL_N = 49
PRODUCT_SB_SOLUTION_SERVER = 50
PRODUCT_SERVER_FOR_SB_SOLUTIONS = 51
PRODUCT_STANDARD_SERVER_SOLUTIONS = 52
PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE = 53
PRODUCT_SB_SOLUTION_SERVER_EM = 54
PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM = 55
PRODUCT_SOLUTION_EMBEDDEDSERVER = 56
PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE = 57
PRODUCT_PROFESSIONAL_EMBEDDED = 58
PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT = 59
PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL = 60
PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC = 61
PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC = 62
PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE = 63
PRODUCT_CLUSTER_SERVER_V = 64
PRODUCT_EMBEDDED = 65
PRODUCT_STARTER_E = 66
PRODUCT_HOME_BASIC_E = 67
PRODUCT_HOME_PREMIUM_E = 68
PRODUCT_PROFESSIONAL_E = 69
PRODUCT_ENTERPRISE_E = 70
PRODUCT_ULTIMATE_E = 71
PRODUCT_ENTERPRISE_EVALUATION = 72
PRODUCT_MULTIPOINT_STANDARD_SERVER = 76
PRODUCT_MULTIPOINT_PREMIUM_SERVER = 77
PRODUCT_STANDARD_EVALUATION_SERVER = 79
PRODUCT_DATACENTER_EVALUATION_SERVER = 80
PRODUCT_ENTERPRISE_N_EVALUATION = 84
PRODUCT_EMBEDDED_AUTOMOTIVE = 85
PRODUCT_EMBEDDED_INDUSTRY_A = 86
PRODUCT_THINPC = 87
PRODUCT_EMBEDDED_A = 88
PRODUCT_EMBEDDED_INDUSTRY = 89
PRODUCT_EMBEDDED_E = 90
PRODUCT_EMBEDDED_INDUSTRY_E = 91
PRODUCT_EMBEDDED_INDUSTRY_A_E = 92
PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVE = 95
PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER = 96
PRODUCT_CORE_ARM = 97
PRODUCT_CORE_N = 98
PRODUCT_CORE_COUNTRYSPECIFIC = 99
PRODUCT_CORE_SINGLELANGUAGE = 100
PRODUCT_CORE = 101
PRODUCT_PROFESSIONAL_WMC = 103
PRODUCT_EMBEDDED_INDUSTRY_EVAL = 105
PRODUCT_EMBEDDED_INDUSTRY_E_EVAL = 106
PRODUCT_EMBEDDED_EVAL = 107
PRODUCT_EMBEDDED_E_EVAL = 108
PRODUCT_NANO_SERVER = 109
PRODUCT_CLOUD_STORAGE_SERVER = 110
PRODUCT_CORE_CONNECTED = 111
PRODUCT_PROFESSIONAL_STUDENT = 112
PRODUCT_CORE_CONNECTED_N = 113
PRODUCT_PROFESSIONAL_STUDENT_N = 114
PRODUCT_CORE_CONNECTED_SINGLELANGUAGE = 115
PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC = 116
PRODUCT_CONNECTED_CAR = 117
PRODUCT_INDUSTRY_HANDHELD = 118
PRODUCT_PPI_PRO = 119
PRODUCT_ARM64_SERVER = 120
PRODUCT_EDUCATION = 121
PRODUCT_EDUCATION_N = 122
PRODUCT_IOTUAP = 123
PRODUCT_CLOUD_HOST_INFRASTRUCTURE_SERVER = 124
PRODUCT_ENTERPRISE_S = 125
PRODUCT_ENTERPRISE_S_N = 126
PRODUCT_PROFESSIONAL_S = 127
PRODUCT_PROFESSIONAL_S_N = 128
PRODUCT_ENTERPRISE_S_EVALUATION = 129
PRODUCT_ENTERPRISE_S_N_EVALUATION = 130
PRODUCT_HOLOGRAPHIC = 135
PRODUCT_PRO_SINGLE_LANGUAGE = 138
PRODUCT_PRO_CHINA = 139
PRODUCT_ENTERPRISE_SUBSCRIPTION = 140
PRODUCT_ENTERPRISE_SUBSCRIPTION_N = 141
PRODUCT_DATACENTER_NANO_SERVER = 143
PRODUCT_STANDARD_NANO_SERVER = 144
PRODUCT_DATACENTER_A_SERVER_CORE = 145
PRODUCT_STANDARD_A_SERVER_CORE = 146
PRODUCT_DATACENTER_WS_SERVER_CORE = 147
PRODUCT_STANDARD_WS_SERVER_CORE = 148
PRODUCT_UTILITY_VM = 149
PRODUCT_DATACENTER_EVALUATION_SERVER_CORE = 159
PRODUCT_STANDARD_EVALUATION_SERVER_CORE = 160
PRODUCT_PRO_WORKSTATION = 161
PRODUCT_PRO_WORKSTATION_N = 162
PRODUCT_PRO_FOR_EDUCATION = 164
PRODUCT_PRO_FOR_EDUCATION_N = 165
PRODUCT_AZURE_SERVER_CORE = 168
PRODUCT_AZURE_NANO_SERVER = 169
PRODUCT_ENTERPRISEG = 171
PRODUCT_ENTERPRISEGN = 172
PRODUCT_SERVERRDSH = 175
PRODUCT_CLOUD = 178
PRODUCT_CLOUDN = 179
PRODUCT_HUBOS = 180
PRODUCT_ONECOREUPDATEOS = 182
PRODUCT_CLOUDE = 183
PRODUCT_ANDROMEDA = 184
PRODUCT_IOTOS = 185
PRODUCT_CLOUDEN = 186
}
Organization
Company name for the registered user of the operating system.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Organization
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty Organization
"Organization = $value"
OSArchitecture
Architecture of the operating system, as opposed to the processor. This property can be localized.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property OSArchitecture
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty OSArchitecture
"OSArchitecture = $value"
OSLanguage
Language version of the operating system installed. Numeric value can be converted to [System.Globalization.CultureInfo] to retrieve the culture name.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property OSLanguage
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty OSLanguage
"OSLanguage = $value"
You can update the PowerShell type database to automatically convert the raw property value. This example illustrates converting raw content to a better .NET type:
# outputting raw value:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty OSLanguage
# updating type database (needs to be done only once per PowerShell session)
# this command instructs PowerShell to automatically convert the property to a different type:
Update-TypeData -MemberName OSLanguage -TypeName 'Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem' -MemberType ScriptProperty -Value { [System.Globalization.CultureInfo][int]($this.PSBase.CimInstanceProperties['OSLanguage'].Value) } -Force
# compare the results of the identical command.
# raw values are now automatically converted to a more suitable .NET type:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty OSLanguage
OSProductSuite
Bitmask of installed and licensed system product additions to the operating system. For example, the value of 146 (0x92) for OSProductSuite indicates Enterprise, Terminal Services, and Data Center (bits one, four, and seven set).
OSProductSuite
works very similar to SuiteMask
. Apparently, SuiteMask
seems to provide richer detail.
OSProductSuite returns a numeric value. To translate it into a meaningful text, use any of the following approaches:
Use Update-Type
Update-Type
tells PowerShell how to interpret the property. This command needs to be executed only once per PowerShell session:
Update-TypeData -MemberName OSProductSuite -TypeName "Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem" -MemberType ScriptProperty -Value {
[Flags()] Enum EnumOSProductSuite
{
SmallBusinessServer = 1
Server2008Enterprise = 2
BackOfficeComponents = 4
CommunicationsServer = 8
TerminalServices = 16
SmallBusinessServerRestricted = 32
WindowsEmbedded = 64
DatacenterEdition = 128
TerminalServicesSingleSession = 256
HomeEdition = 512
WebServerEdition = 1024
StorageServerEdition = 8192
ComputeClusterEdition = 16384
}
[EnumOSProductSuite]($this.PSBase.CimInstanceProperties['OSProductSuite'].Value)
} -Force
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property OSProductSuite
Use Select-Object
Select-Object
supports calculated properties. When you submit a hashtable, PowerShell dynamically calculates the result:
$OSProductSuite = @{
Name = 'OSProductSuiteText'
Expression = {
[Flags()] Enum EnumOSProductSuite
{
SmallBusinessServer = 1
Server2008Enterprise = 2
BackOfficeComponents = 4
CommunicationsServer = 8
TerminalServices = 16
SmallBusinessServerRestricted = 32
WindowsEmbedded = 64
DatacenterEdition = 128
TerminalServicesSingleSession = 256
HomeEdition = 512
WebServerEdition = 1024
StorageServerEdition = 8192
ComputeClusterEdition = 16384
}
[EnumOSProductSuite][int]$_.OSProductSuite
}
}
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Caption, OSProductSuite, $OSProductSuite
Use a PowerShell Hashtable
You can use a PowerShell hashtable to decode numeric values. Use a hashtable like this one:
$OSProductSuite_map = @{
1 = 'SmallBusinessServer'
2 = 'Server2008Enterprise'
4 = 'BackOfficeComponents'
8 = 'CommunicationsServer'
16 = 'TerminalServices'
32 = 'SmallBusinessServerRestricted'
64 = 'WindowsEmbedded'
128 = 'DatacenterEdition'
256 = 'TerminalServicesSingleSession'
512 = 'HomeEdition'
1024 = 'WebServerEdition'
8192 = 'StorageServerEdition'
16384 = 'ComputeClusterEdition'
}
Use Enum structure
You can cast the raw property values to a new enum type to translate raw numeric values into friendly text. Use an enum like this one:
[Flags()] Enum EnumOSProductSuite
{
SmallBusinessServer = 1
Server2008Enterprise = 2
BackOfficeComponents = 4
CommunicationsServer = 8
TerminalServices = 16
SmallBusinessServerRestricted = 32
WindowsEmbedded = 64
DatacenterEdition = 128
TerminalServicesSingleSession = 256
HomeEdition = 512
WebServerEdition = 1024
StorageServerEdition = 8192
ComputeClusterEdition = 16384
}
OSType
Type of operating system. The following list identifies the possible values.
OSType returns a numeric value. To translate it into a meaningful text, use any of the following approaches:
Use Update-Type
Update-Type
tells PowerShell how to interpret the property. This command needs to be executed only once per PowerShell session:
Update-TypeData -MemberName OSType -TypeName "Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem" -MemberType ScriptProperty -Value {
Enum EnumOSType
{
Unknown = 0
Other = 1
MacOS = 2
ATTUnix = 3
DGUnix = 4
DECNT = 5
Digital_Unix = 6
OpenVMS = 7
HPUnix = 8
AIX = 9
MVS = 10
OS400 = 11
OS2 = 12
JavaVM = 13
MSDOS = 14
Windows3x = 15
Windows95 = 16
Windows98 = 17
WindowsNT = 18
WindowsCE = 19
NCR3000 = 20
NetWare = 21
OSF = 22
DCOS = 23
ReliantUNIX = 24
SCOUnixWare = 25
SCOOpenServer = 26
Sequent = 27
IRIX = 28
Solaris = 29
SunOS = 30
U6000 = 31
ASERIES = 32
TandemNSK = 33
TandemNT = 34
BS2000 = 35
LINUX = 36
Lynx = 37
XENIX = 38
VMESA = 39
Interactive_Unix = 40
BSDUnix = 41
FreeBSD = 42
NetBSD = 43
GNU_Hurd = 44
OS9 = 45
MACH_Kernel = 46
Inferno = 47
QNX = 48
EPOC = 49
IxWorks = 50
VxWorks = 51
MiNT = 52
BeOS = 53
HP_MPE = 54
NextStep = 55
PalmPilot = 56
Rhapsody = 57
Windows_2000 = 58
Dedicated = 59
OS390 = 60
VSE = 61
TPF = 62
}
[EnumOSType]($this.PSBase.CimInstanceProperties['OSType'].Value)
} -Force
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property OSType
Use Select-Object
Select-Object
supports calculated properties. When you submit a hashtable, PowerShell dynamically calculates the result:
$OSType = @{
Name = 'OSTypeText'
Expression = {
$value = $_.OSType
switch([int]$value)
{
0 {'Unknown'}
1 {'Other'}
2 {'MacOS'}
3 {'ATTUnix'}
4 {'DGUnix'}
5 {'DECNT'}
6 {'Digital Unix'}
7 {'OpenVMS'}
8 {'HPUnix'}
9 {'AIX'}
10 {'MVS'}
11 {'OS400'}
12 {'OS/2'}
13 {'JavaVM'}
14 {'MSDOS'}
15 {'Windows3x'}
16 {'Windows95'}
17 {'Windows98'}
18 {'WindowsNT'}
19 {'WindowsCE'}
20 {'NCR3000'}
21 {'NetWare'}
22 {'OSF'}
23 {'DC/OS'}
24 {'ReliantUNIX'}
25 {'SCOUnixWare'}
26 {'SCOOpenServer'}
27 {'Sequent'}
28 {'IRIX'}
29 {'Solaris'}
30 {'SunOS'}
31 {'U6000'}
32 {'ASERIES'}
33 {'TandemNSK'}
34 {'TandemNT'}
35 {'BS2000'}
36 {'LINUX'}
37 {'Lynx'}
38 {'XENIX'}
39 {'VM/ESA'}
40 {'Interactive Unix'}
41 {'BSDUnix'}
42 {'FreeBSD'}
43 {'NetBSD'}
44 {'GNU Hurd'}
45 {'OS9'}
46 {'MACH Kernel'}
47 {'Inferno'}
48 {'QNX'}
49 {'EPOC'}
50 {'IxWorks'}
51 {'VxWorks'}
52 {'MiNT'}
53 {'BeOS'}
54 {'HP MPE'}
55 {'NextStep'}
56 {'PalmPilot'}
57 {'Rhapsody'}
58 {'Windows 2000'}
59 {'Dedicated'}
60 {'OS/390'}
61 {'VSE'}
62 {'TPF'}
default {"$value"}
}
}
}
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Caption, OSType, $OSType
Use a PowerShell Hashtable
You can use a PowerShell hashtable to decode numeric values. Use a hashtable like this one:
$OSType_map = @{
0 = 'Unknown'
1 = 'Other'
2 = 'MacOS'
3 = 'ATTUnix'
4 = 'DGUnix'
5 = 'DECNT'
6 = 'Digital Unix'
7 = 'OpenVMS'
8 = 'HPUnix'
9 = 'AIX'
10 = 'MVS'
11 = 'OS400'
12 = 'OS/2'
13 = 'JavaVM'
14 = 'MSDOS'
15 = 'Windows3x'
16 = 'Windows95'
17 = 'Windows98'
18 = 'WindowsNT'
19 = 'WindowsCE'
20 = 'NCR3000'
21 = 'NetWare'
22 = 'OSF'
23 = 'DC/OS'
24 = 'ReliantUNIX'
25 = 'SCOUnixWare'
26 = 'SCOOpenServer'
27 = 'Sequent'
28 = 'IRIX'
29 = 'Solaris'
30 = 'SunOS'
31 = 'U6000'
32 = 'ASERIES'
33 = 'TandemNSK'
34 = 'TandemNT'
35 = 'BS2000'
36 = 'LINUX'
37 = 'Lynx'
38 = 'XENIX'
39 = 'VM/ESA'
40 = 'Interactive Unix'
41 = 'BSDUnix'
42 = 'FreeBSD'
43 = 'NetBSD'
44 = 'GNU Hurd'
45 = 'OS9'
46 = 'MACH Kernel'
47 = 'Inferno'
48 = 'QNX'
49 = 'EPOC'
50 = 'IxWorks'
51 = 'VxWorks'
52 = 'MiNT'
53 = 'BeOS'
54 = 'HP MPE'
55 = 'NextStep'
56 = 'PalmPilot'
57 = 'Rhapsody'
58 = 'Windows 2000'
59 = 'Dedicated'
60 = 'OS/390'
61 = 'VSE'
62 = 'TPF'
}
Use Enum structure
You can cast the raw property values to a new enum type to translate raw numeric values into friendly text. Use an enum like this one:
Enum EnumOSType
{
Unknown = 0
Other = 1
MacOS = 2
ATTUnix = 3
DGUnix = 4
DECNT = 5
Digital_Unix = 6
OpenVMS = 7
HPUnix = 8
AIX = 9
MVS = 10
OS400 = 11
OS2 = 12
JavaVM = 13
MSDOS = 14
Windows3x = 15
Windows95 = 16
Windows98 = 17
WindowsNT = 18
WindowsCE = 19
NCR3000 = 20
NetWare = 21
OSF = 22
DCOS = 23
ReliantUNIX = 24
SCOUnixWare = 25
SCOOpenServer = 26
Sequent = 27
IRIX = 28
Solaris = 29
SunOS = 30
U6000 = 31
ASERIES = 32
TandemNSK = 33
TandemNT = 34
BS2000 = 35
LINUX = 36
Lynx = 37
XENIX = 38
VMESA = 39
Interactive_Unix = 40
BSDUnix = 41
FreeBSD = 42
NetBSD = 43
GNU_Hurd = 44
OS9 = 45
MACH_Kernel = 46
Inferno = 47
QNX = 48
EPOC = 49
IxWorks = 50
VxWorks = 51
MiNT = 52
BeOS = 53
HP_MPE = 54
NextStep = 55
PalmPilot = 56
Rhapsody = 57
Windows_2000 = 58
Dedicated = 59
OS390 = 60
VSE = 61
TPF = 62
}
OtherTypeDescription
Additional description for the current operating system version.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property OtherTypeDescription
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty OtherTypeDescription
"OtherTypeDescription = $value"
PAEEnabled
If $true
the physical address extensions (PAE) are enabled by the operating system running on Intel processors. PAE allows applications to address more than 4 GB of physical memory. When PAE is enabled, the operating system uses three-level linear address translation rather than two-level. Providing more physical memory to an application reduces the need to swap memory to the page file and increases performance. To enable, PAE, use the “/PAE” switch in the Boot.ini file. For more information about the Physical Address Extension feature, see https://Go.Microsoft.Com/FWLink/p/?LinkID=45912.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property PAEEnabled
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty PAEEnabled
"PAEEnabled = $value"
PortableOperatingSystem
Specifies whether the operating system booted from an external USB device. If true, the operating system has detected it is booting on a supported locally connected storage device.
Windows Server® 2008® R2, Windows® 7, Windows Server® 2008 and Windows® Vista: This property is not supported before Windows® 8 and Windows Server® 2012.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property PortableOperatingSystem
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty PortableOperatingSystem
"PortableOperatingSystem = $value"
Primary
Specifies whether this is the primary operating system.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Primary
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty Primary
"Primary = $value"
ProductType
Additional system information.
ProductType returns a numeric value. To translate it into a meaningful text, use any of the following approaches:
Use Update-Type
Update-Type
tells PowerShell how to interpret the property. This command needs to be executed only once per PowerShell session:
Update-TypeData -MemberName ProductType -TypeName "Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem" -MemberType ScriptProperty -Value {
Enum EnumProductType
{
Workstation = 1
DomainController = 2
Server = 3
}
[EnumProductType]($this.PSBase.CimInstanceProperties['ProductType'].Value)
} -Force
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property ProductType
Use Select-Object
Select-Object
supports calculated properties. When you submit a hashtable, PowerShell dynamically calculates the result:
$ProductType = @{
Name = 'ProductTypeText'
Expression = {
$value = $_.ProductType
switch([int]$value)
{
1 {'Workstation'}
2 {'DomainController'}
3 {'Server'}
default {"$value"}
}
}
}
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Caption, ProductType, $ProductType
Use a PowerShell Hashtable
You can use a PowerShell hashtable to decode numeric values. Use a hashtable like this one:
$ProductType_map = @{
1 = 'Workstation'
2 = 'DomainController'
3 = 'Server'
}
Use Enum structure
You can cast the raw property values to a new enum type to translate raw numeric values into friendly text. Use an enum like this one:
Enum EnumProductType
{
Workstation = 1
DomainController = 2
Server = 3
}
RegisteredUser
Name of the registered user of the operating system.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property RegisteredUser
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty RegisteredUser
"RegisteredUser = $value"
SerialNumber
Operating system product serial identification number.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property SerialNumber
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty SerialNumber
"SerialNumber = $value"
ServicePackMajorVersion
Major version number of the service pack installed on the computer system. If no service pack has been installed, the value is 0 (zero).
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property ServicePackMajorVersion
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty ServicePackMajorVersion
"ServicePackMajorVersion = $value"
ServicePackMinorVersion
Minor version number of the service pack installed on the computer system. If no service pack has been installed, the value is 0 (zero).
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property ServicePackMinorVersion
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty ServicePackMinorVersion
"ServicePackMinorVersion = $value"
SizeStoredInPagingFiles
Total number of kilobytes that can be stored in the operating system paging files. 0 (zero) indicates that there are no paging files. Be aware that this number does not represent the actual physical size of the paging file on disk.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property SizeStoredInPagingFiles
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty SizeStoredInPagingFiles
"SizeStoredInPagingFiles = ${value} kilobytes"
'SizeStoredInPagingFiles = {0:n1} GB' -f ($value/1MB)
You can update the PowerShell type database to automatically convert the raw property value. This example illustrates overwriting ToString() method to provide formatted output while leaving the original property value untouched:
# outputting raw value:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty SizeStoredInPagingFiles
# updating type database (needs to be done only once per PowerShell session)
# this command instructs PowerShell to overwrite the method ToString() and automatically divide the raw value and transform it in a different unit:
Update-TypeData -MemberName SizeStoredInPagingFiles -TypeName 'Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem' -MemberType ScriptProperty -Value { ($this.PSBase.CimInstanceProperties['SizeStoredInPagingFiles'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru } -Force
# compare the results of the identical command.
# raw values are now automatically transformed into a more meaningful unit:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty SizeStoredInPagingFiles
Status
Current status of an object. Various operational and nonoperational statuses can be defined.
Available values:
'Degraded','Error','Lost Comm','No Contact','NonRecover','OK','Pred Fail','Service','Starting','Stopping','Stressed','Unknown'
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Status
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty Status
"Status = $value"
SuiteMask
Bit flags that identify the product suites available on the system.
For example, to specify both Personal and BackOffice, set SuiteMask to 4 | 512
or 516
.
SuiteMask
works very similar to OSProductSuite
. Apparently, SuiteMask
seems to provide richer detail.
SuiteMask returns a numeric value. To translate it into a meaningful text, use any of the following approaches:
Use Update-Type
Update-Type
tells PowerShell how to interpret the property. This command needs to be executed only once per PowerShell session:
Update-TypeData -MemberName SuiteMask -TypeName "Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem" -MemberType ScriptProperty -Value {
[Flags()] Enum EnumSuiteMask
{
SmallBusinessServer = 1
Server2008Enterprise = 2
BackOfficeComponents = 4
CommunicationsServer = 8
TerminalServices = 16
SmallBusinessServerRestricted = 32
WindowsEmbedded = 64
DatacenterEdition = 128
TerminalServicesSingleSession = 256
HomeEdition = 512
WebServerEdition = 1024
StorageServerEdition = 8192
ComputeClusterEdition = 16384
}
[EnumSuiteMask]($this.PSBase.CimInstanceProperties['SuiteMask'].Value)
} -Force
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property SuiteMask
Use Select-Object
Select-Object
supports calculated properties. When you submit a hashtable, PowerShell dynamically calculates the result:
$SuiteMask = @{
Name = 'SuiteMaskText'
Expression = {
[Flags()] Enum EnumSuiteMask
{
SmallBusinessServer = 1
Server2008Enterprise = 2
BackOfficeComponents = 4
CommunicationsServer = 8
TerminalServices = 16
SmallBusinessServerRestricted = 32
WindowsEmbedded = 64
DatacenterEdition = 128
TerminalServicesSingleSession = 256
HomeEdition = 512
WebServerEdition = 1024
StorageServerEdition = 8192
ComputeClusterEdition = 16384
}
[EnumSuiteMask][int]$_.SuiteMask
}
}
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Caption, SuiteMask, $SuiteMask
Use a PowerShell Hashtable
You can use a PowerShell hashtable to decode numeric values. Use a hashtable like this one:
$SuiteMask_map = @{
1 = 'SmallBusinessServer'
2 = 'Server2008Enterprise'
4 = 'BackOfficeComponents'
8 = 'CommunicationsServer'
16 = 'TerminalServices'
32 = 'SmallBusinessServerRestricted'
64 = 'WindowsEmbedded'
128 = 'DatacenterEdition'
256 = 'TerminalServicesSingleSession'
512 = 'HomeEdition'
1024 = 'WebServerEdition'
8192 = 'StorageServerEdition'
16384 = 'ComputeClusterEdition'
}
Use Enum structure
You can cast the raw property values to a new enum type to translate raw numeric values into friendly text. Use an enum like this one:
[Flags()] Enum EnumSuiteMask
{
SmallBusinessServer = 1
Server2008Enterprise = 2
BackOfficeComponents = 4
CommunicationsServer = 8
TerminalServices = 16
SmallBusinessServerRestricted = 32
WindowsEmbedded = 64
DatacenterEdition = 128
TerminalServicesSingleSession = 256
HomeEdition = 512
WebServerEdition = 1024
StorageServerEdition = 8192
ComputeClusterEdition = 16384
}
SystemDevice
Physical disk partition on which the operating system is installed.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property SystemDevice
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty SystemDevice
"SystemDevice = $value"
SystemDirectory
System directory of the operating system.
Example: “C:\WINDOWS\SYSTEM32”
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property SystemDirectory
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty SystemDirectory
"SystemDirectory = $value"
SystemDrive
Letter of the disk drive on which the operating system resides.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property SystemDrive
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty SystemDrive
"SystemDrive = $value"
TotalSwapSpaceSize
Total swap space in kilobytes. This value may be NULL (unspecified) if the swap space is not distinguished from page files. However, some operating systems distinguish these concepts. For example, in UNIX, whole processes can be swapped out when the free page list falls and remains below a specified amount.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property TotalSwapSpaceSize
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty TotalSwapSpaceSize
"TotalSwapSpaceSize = ${value} kilobytes"
'TotalSwapSpaceSize = {0:n1} GB' -f ($value/1MB)
You can update the PowerShell type database to automatically convert the raw property value. This example illustrates overwriting ToString() method to provide formatted output while leaving the original property value untouched:
# outputting raw value:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty TotalSwapSpaceSize
# updating type database (needs to be done only once per PowerShell session)
# this command instructs PowerShell to overwrite the method ToString() and automatically divide the raw value and transform it in a different unit:
Update-TypeData -MemberName TotalSwapSpaceSize -TypeName 'Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem' -MemberType ScriptProperty -Value { ($this.PSBase.CimInstanceProperties['TotalSwapSpaceSize'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru } -Force
# compare the results of the identical command.
# raw values are now automatically transformed into a more meaningful unit:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty TotalSwapSpaceSize
TotalVirtualMemorySize
Number, in kilobytes, of virtual memory. For example, this may be calculated by adding the amount of total RAM to the amount of paging space, that is, adding the amount of memory in or aggregated by the computer system to the property, SizeStoredInPagingFiles.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property TotalVirtualMemorySize
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty TotalVirtualMemorySize
"TotalVirtualMemorySize = ${value} kilobytes"
'TotalVirtualMemorySize = {0:n1} GB' -f ($value/1MB)
You can update the PowerShell type database to automatically convert the raw property value. This example illustrates overwriting ToString() method to provide formatted output while leaving the original property value untouched:
# outputting raw value:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty TotalVirtualMemorySize
# updating type database (needs to be done only once per PowerShell session)
# this command instructs PowerShell to overwrite the method ToString() and automatically divide the raw value and transform it in a different unit:
Update-TypeData -MemberName TotalVirtualMemorySize -TypeName 'Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem' -MemberType ScriptProperty -Value { ($this.PSBase.CimInstanceProperties['TotalVirtualMemorySize'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru } -Force
# compare the results of the identical command.
# raw values are now automatically transformed into a more meaningful unit:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty TotalVirtualMemorySize
TotalVisibleMemorySize
Total amount, in kilobytes, of physical memory available to the operating system. This value does not necessarily indicate the true amount of physical memory, but what is reported to the operating system as available to it.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property TotalVisibleMemorySize
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty TotalVisibleMemorySize
"TotalVisibleMemorySize = ${value} kilobytes"
'TotalVisibleMemorySize = {0:n1} GB' -f ($value/1MB)
You can update the PowerShell type database to automatically convert the raw property value. This example illustrates overwriting ToString() method to provide formatted output while leaving the original property value untouched:
# outputting raw value:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty TotalVisibleMemorySize
# updating type database (needs to be done only once per PowerShell session)
# this command instructs PowerShell to overwrite the method ToString() and automatically divide the raw value and transform it in a different unit:
Update-TypeData -MemberName TotalVisibleMemorySize -TypeName 'Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem' -MemberType ScriptProperty -Value { ($this.PSBase.CimInstanceProperties['TotalVisibleMemorySize'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru } -Force
# compare the results of the identical command.
# raw values are now automatically transformed into a more meaningful unit:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty TotalVisibleMemorySize
Version
Version number of the operating system.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Version
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty Version
"Version = $value"
# convert property value:
[Version]$value
You can update the PowerShell type database to automatically convert the raw property value. This example illustrates converting raw content to a better .NET type:
# outputting raw value:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty Version
# updating type database (needs to be done only once per PowerShell session)
# this command instructs PowerShell to automatically convert the property to a different type:
Update-TypeData -MemberName Version -TypeName 'Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem' -MemberType ScriptProperty -Value { [Version]($this.PSBase.CimInstanceProperties['Version'].Value) } -Force
# compare the results of the identical command.
# raw values are now automatically converted to a more suitable .NET type:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty Version
WindowsDirectory
Windows directory of the operating system.
# returning class instances:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property WindowsDirectory
# reading property value:
$value = Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty WindowsDirectory
"WindowsDirectory = $value"
CDXML Definition
You can turn this WMI class and its methods into PowerShell cmdlets by importing below CDXML file (Cmdlet Definition XML) as a module.
Create Win32_OperatingSystem.cdxml
$folder = "c:\wmi\Win32_OperatingSystem"
$cdxmlPath = Join-Path -Path $folder -ChildPath "Win32_OperatingSystem.cdxml"
# create folder if not present:
$exists = Test-Path -Path $folder
if (!$exists) { $null = New-Item -Path $folder -ItemType Directory }
# write file
$content = @'
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is licensed under 'Attribution 4.0 International' license (https://creativecommons.org/licenses/by/4.0/).
You can free of charge use this code in commercial and non-commercial code, and you can freely modify and adjust the code
as long as you give appropriate credit to the original author Dr. Tobias Weltner.
This material was published and is maintained here:
https://powershell.one/wmi/root/cimv2/win32_operatingsystem#cdxml-definition
-->
<PowerShellMetadata xmlns="http://schemas.microsoft.com/cmdlets-over-objects/2009/11">
<!--referencing the WMI class this cdxml uses-->
<Class ClassName="Root/CIMV2\Win32_OperatingSystem" ClassVersion="2.0">
<Version>1.0</Version>
<!--default noun used by Get-cmdlets and when no other noun is specified. By convention, we use the prefix "WMI" and the base name of the WMI class involved. This way, you can easily identify the underlying WMI class.-->
<DefaultNoun>WmiOperatingSystem</DefaultNoun>
<!--define the cmdlets that work with class instances.-->
<InstanceCmdlets>
<!--query parameters to select instances. This is typically empty for classes that provide only one instance-->
<GetCmdletParameters />
<!--defining additional cmdlets that modifies instance properties-->
<!--Set-OperatingSystem: modifying instance properties-->
<Cmdlet>
<!--defining the ConfirmImpact which indicates how severe the changes are that this cmdlet performs-->
<CmdletMetadata Verb="Set" ConfirmImpact="Low" />
<!--using internal method to modify instance:-->
<Method MethodName="cim:ModifyInstance">
<!--defining the parameters of this cmdlet:-->
<Parameters>
<Parameter ParameterName="Description">
<!--the underlying parameter type is string which corresponds to the PowerShell .NET type [system.string]-->
<Type PSType="system.string" />
<CmdletParameterMetadata IsMandatory="false">
<ValidateNotNull />
<ValidateNotNullOrEmpty />
</CmdletParameterMetadata>
</Parameter>
<Parameter ParameterName="ForegroundApplicationBoost">
<!--the underlying parameter type is uint8 which really is the enumeration [Win32_OperatingSystem.ForegroundApplicationBoost] that is defined below in the Enums node:-->
<Type PSType="Win32_OperatingSystem.ForegroundApplicationBoost" />
<CmdletParameterMetadata IsMandatory="false">
<ValidateNotNull />
<ValidateNotNullOrEmpty />
</CmdletParameterMetadata>
</Parameter>
</Parameters>
</Method>
</Cmdlet>
<!--Invoke-OperatingSystemReboot: invoking method Reboot():-->
<Cmdlet>
<!--defining the ConfirmImpact which indicates how severe the changes are that this cmdlet performs-->
<CmdletMetadata Verb="Invoke" Noun="WmiOperatingSystemReboot" ConfirmImpact="High" />
<!--defining the WMI instance method used by this cmdlet:-->
<Method MethodName="Reboot">
<ReturnValue>
<Type PSType="system.uint32" />
<CmdletOutputMetadata>
<ErrorCode />
</CmdletOutputMetadata>
</ReturnValue>
</Method>
</Cmdlet>
<!--Set-OperatingSystemDateTime: invoking method SetDateTime():-->
<Cmdlet>
<!--defining the ConfirmImpact which indicates how severe the changes are that this cmdlet performs-->
<CmdletMetadata Verb="Set" Noun="WmiOperatingSystemDateTime" ConfirmImpact="High" />
<!--defining the WMI instance method used by this cmdlet:-->
<Method MethodName="SetDateTime">
<ReturnValue>
<Type PSType="system.uint32" />
<CmdletOutputMetadata>
<ErrorCode />
</CmdletOutputMetadata>
</ReturnValue>
<!--defining the parameters of this cmdlet:-->
<Parameters>
<!--native parameter name is 'LocalDateTime'-->
<Parameter ParameterName="LocalDateTime">
<!--the underlying parameter type is DateTime which corresponds to the PowerShell .NET type [system.DateTime]-->
<Type PSType="system.DateTime" />
<CmdletParameterMetadata Position="0" IsMandatory="false">
<ValidateNotNull />
<ValidateNotNullOrEmpty />
</CmdletParameterMetadata>
</Parameter>
</Parameters>
</Method>
</Cmdlet>
<!--Invoke-OperatingSystemShutdown: invoking method Shutdown():-->
<Cmdlet>
<!--defining the ConfirmImpact which indicates how severe the changes are that this cmdlet performs-->
<CmdletMetadata Verb="Invoke" Noun="WmiOperatingSystemShutdown" ConfirmImpact="High" />
<!--defining the WMI instance method used by this cmdlet:-->
<Method MethodName="Shutdown">
<ReturnValue>
<Type PSType="system.uint32" />
<CmdletOutputMetadata>
<ErrorCode />
</CmdletOutputMetadata>
</ReturnValue>
</Method>
</Cmdlet>
<!--Invoke-OperatingSystemWin32Shutdown: invoking method Win32Shutdown():-->
<Cmdlet>
<!--defining the ConfirmImpact which indicates how severe the changes are that this cmdlet performs-->
<CmdletMetadata Verb="Invoke" Noun="WmiOperatingSystemWin32Shutdown" ConfirmImpact="High" />
<!--defining the WMI instance method used by this cmdlet:-->
<Method MethodName="Win32Shutdown">
<ReturnValue>
<Type PSType="system.uint32" />
<CmdletOutputMetadata>
<ErrorCode />
</CmdletOutputMetadata>
</ReturnValue>
<!--defining the parameters of this cmdlet:-->
<Parameters>
<!--native parameter name is 'Flags'-->
<Parameter ParameterName="Flags">
<!--the underlying parameter type is SInt32 which really is the enumeration [Win32_OperatingSystem.Flags] that is defined below in the Enums node:-->
<Type PSType="Win32_OperatingSystem.Flags" />
<CmdletParameterMetadata Position="0" IsMandatory="false">
<ValidateNotNull />
<ValidateNotNullOrEmpty />
</CmdletParameterMetadata>
</Parameter>
</Parameters>
</Method>
</Cmdlet>
<!--Invoke-OperatingSystemWin32ShutdownTracker: invoking method Win32ShutdownTracker():-->
<Cmdlet>
<!--defining the ConfirmImpact which indicates how severe the changes are that this cmdlet performs-->
<CmdletMetadata Verb="Invoke" Noun="WmiOperatingSystemWin32ShutdownTracker" Aliases="ShutdownTracker wost" ConfirmImpact="High" />
<!--defining the WMI instance method used by this cmdlet:-->
<Method MethodName="Win32ShutdownTracker">
<ReturnValue>
<Type PSType="system.uint32" />
<CmdletOutputMetadata>
<ErrorCode />
</CmdletOutputMetadata>
</ReturnValue>
<!--defining the parameters of this cmdlet:-->
<Parameters>
<!--native parameter name is 'Flags'-->
<Parameter ParameterName="Flags">
<!--the underlying parameter type is SInt32 which really is the enumeration [Win32_OperatingSystem.Flags] that is defined below in the Enums node:-->
<Type PSType="Win32_OperatingSystem.Flags" />
<CmdletParameterMetadata Position="0" IsMandatory="false">
<ValidateNotNull />
<ValidateNotNullOrEmpty />
</CmdletParameterMetadata>
</Parameter>
<!--native parameter name is 'Timeout'-->
<Parameter ParameterName="Timeout">
<!--the underlying parameter type is UInt32 which corresponds to the PowerShell .NET type [system.UInt32]-->
<Type PSType="system.UInt32" />
<CmdletParameterMetadata Position="1" IsMandatory="false">
<ValidateNotNull />
<ValidateNotNullOrEmpty />
</CmdletParameterMetadata>
</Parameter>
<!--native parameter name is 'Comment'-->
<Parameter ParameterName="Comment">
<!--the underlying parameter type is String which corresponds to the PowerShell .NET type [system.String]-->
<Type PSType="system.String" />
<CmdletParameterMetadata Position="2" IsMandatory="false">
<ValidateNotNull />
<ValidateNotNullOrEmpty />
</CmdletParameterMetadata>
</Parameter>
<!--native parameter name is 'ReasonCode'-->
<Parameter ParameterName="ReasonCode">
<!--the underlying parameter type is UInt32 which corresponds to the PowerShell .NET type [system.UInt32]-->
<Type PSType="system.UInt32" />
<CmdletParameterMetadata Position="3" IsMandatory="false">
<ValidateNotNull />
<ValidateNotNullOrEmpty />
</CmdletParameterMetadata>
</Parameter>
</Parameters>
</Method>
</Cmdlet>
</InstanceCmdlets>
</Class>
<!--defining enumerations-->
<Enums>
<Enum EnumName="Win32_OperatingSystem.DataExecutionPrevention_SupportPolicy" UnderlyingType="byte">
<Value Name="AlwaysOff" Value="0" />
<Value Name="AlwaysOn" Value="1" />
<Value Name="OptIn" Value="2" />
<Value Name="OptOut" Value="3" />
</Enum>
<Enum EnumName="Win32_OperatingSystem.Flags" UnderlyingType="int" BitwiseFlags="true">
<Value Name="Logoff" Value="0" />
<Value Name="Shutdown" Value="1" />
<Value Name="Reboot" Value="2" />
<Value Name="Force" Value="4" />
<Value Name="PowerOff" Value="8" />
</Enum>
<Enum EnumName="Win32_OperatingSystem.ForegroundApplicationBoost" UnderlyingType="byte">
<Value Name="None" Value="0" />
<Value Name="Minimum" Value="1" />
<Value Name="Maximum" Value="2" />
</Enum>
<Enum EnumName="Win32_OperatingSystem.OperatingSystemSKU" UnderlyingType="system.uint32">
<Value Name="PRODUCTUNDEFINED" Value="0" />
<Value Name="PRODUCTULTIMATE" Value="1" />
<Value Name="PRODUCTHOMEBASIC" Value="2" />
<Value Name="PRODUCTHOMEPREMIUM" Value="3" />
<Value Name="PRODUCTENTERPRISE" Value="4" />
<Value Name="PRODUCTHOMEBASICN" Value="5" />
<Value Name="PRODUCTBUSINESS" Value="6" />
<Value Name="PRODUCTSTANDARDSERVER" Value="7" />
<Value Name="PRODUCTDATACENTERSERVER" Value="8" />
<Value Name="PRODUCTSMALLBUSINESSSERVER" Value="9" />
<Value Name="PRODUCTENTERPRISESERVER" Value="10" />
<Value Name="PRODUCTSTARTER" Value="11" />
<Value Name="PRODUCTDATACENTERSERVERCORE" Value="12" />
<Value Name="PRODUCTSTANDARDSERVERCORE" Value="13" />
<Value Name="PRODUCTENTERPRISESERVERCORE" Value="14" />
<Value Name="PRODUCTENTERPRISESERVERIA64" Value="15" />
<Value Name="PRODUCTBUSINESSN" Value="16" />
<Value Name="PRODUCTWEBSERVER" Value="17" />
<Value Name="PRODUCTCLUSTERSERVER" Value="18" />
<Value Name="PRODUCTHOMESERVER" Value="19" />
<Value Name="PRODUCTSTORAGEEXPRESSSERVER" Value="20" />
<Value Name="PRODUCTSTORAGESTANDARDSERVER" Value="21" />
<Value Name="PRODUCTSTORAGEWORKGROUPSERVER" Value="22" />
<Value Name="PRODUCTSTORAGEENTERPRISESERVER" Value="23" />
<Value Name="PRODUCTSERVERFORSMALLBUSINESS" Value="24" />
<Value Name="PRODUCTSMALLBUSINESSSERVERPREMIUM" Value="25" />
<Value Name="PRODUCTHOMEPREMIUMN" Value="26" />
<Value Name="PRODUCTENTERPRISEN" Value="27" />
<Value Name="PRODUCTULTIMATEN" Value="28" />
<Value Name="PRODUCTWEBSERVERCORE" Value="29" />
<Value Name="PRODUCTMEDIUMBUSINESSSERVERMANAGEMENT" Value="30" />
<Value Name="PRODUCTMEDIUMBUSINESSSERVERSECURITY" Value="31" />
<Value Name="PRODUCTMEDIUMBUSINESSSERVERMESSAGING" Value="32" />
<Value Name="PRODUCTSERVERFOUNDATION" Value="33" />
<Value Name="PRODUCTHOMEPREMIUMSERVER" Value="34" />
<Value Name="PRODUCTSERVERFORSMALLBUSINESSV" Value="35" />
<Value Name="PRODUCTSTANDARDSERVERV" Value="36" />
<Value Name="PRODUCTDATACENTERSERVERV" Value="37" />
<Value Name="PRODUCTENTERPRISESERVERV" Value="38" />
<Value Name="PRODUCTDATACENTERSERVERCOREV" Value="39" />
<Value Name="PRODUCTSTANDARDSERVERCOREV" Value="40" />
<Value Name="PRODUCTENTERPRISESERVERCOREV" Value="41" />
<Value Name="PRODUCTHYPERV" Value="42" />
<Value Name="PRODUCTSTORAGEEXPRESSSERVERCORE" Value="43" />
<Value Name="PRODUCTSTORAGESTANDARDSERVERCORE" Value="44" />
<Value Name="PRODUCTSTORAGEWORKGROUPSERVERCORE" Value="45" />
<Value Name="PRODUCTSTORAGEENTERPRISESERVERCORE" Value="46" />
<Value Name="PRODUCTSTARTERN" Value="47" />
<Value Name="PRODUCTPROFESSIONAL" Value="48" />
<Value Name="PRODUCTPROFESSIONALN" Value="49" />
<Value Name="PRODUCTSBSOLUTIONSERVER" Value="50" />
<Value Name="PRODUCTSERVERFORSBSOLUTIONS" Value="51" />
<Value Name="PRODUCTSTANDARDSERVERSOLUTIONS" Value="52" />
<Value Name="PRODUCTSTANDARDSERVERSOLUTIONSCORE" Value="53" />
<Value Name="PRODUCTSBSOLUTIONSERVEREM" Value="54" />
<Value Name="PRODUCTSERVERFORSBSOLUTIONSEM" Value="55" />
<Value Name="PRODUCTSOLUTIONEMBEDDEDSERVER" Value="56" />
<Value Name="PRODUCTSOLUTIONEMBEDDEDSERVERCORE" Value="57" />
<Value Name="PRODUCTPROFESSIONALEMBEDDED" Value="58" />
<Value Name="PRODUCTESSENTIALBUSINESSSERVERMGMT" Value="59" />
<Value Name="PRODUCTESSENTIALBUSINESSSERVERADDL" Value="60" />
<Value Name="PRODUCTESSENTIALBUSINESSSERVERMGMTSVC" Value="61" />
<Value Name="PRODUCTESSENTIALBUSINESSSERVERADDLSVC" Value="62" />
<Value Name="PRODUCTSMALLBUSINESSSERVERPREMIUMCORE" Value="63" />
<Value Name="PRODUCTCLUSTERSERVERV" Value="64" />
<Value Name="PRODUCTEMBEDDED" Value="65" />
<Value Name="PRODUCTSTARTERE" Value="66" />
<Value Name="PRODUCTHOMEBASICE" Value="67" />
<Value Name="PRODUCTHOMEPREMIUME" Value="68" />
<Value Name="PRODUCTPROFESSIONALE" Value="69" />
<Value Name="PRODUCTENTERPRISEE" Value="70" />
<Value Name="PRODUCTULTIMATEE" Value="71" />
<Value Name="PRODUCTENTERPRISEEVALUATION" Value="72" />
<Value Name="PRODUCTMULTIPOINTSTANDARDSERVER" Value="76" />
<Value Name="PRODUCTMULTIPOINTPREMIUMSERVER" Value="77" />
<Value Name="PRODUCTSTANDARDEVALUATIONSERVER" Value="79" />
<Value Name="PRODUCTDATACENTEREVALUATIONSERVER" Value="80" />
<Value Name="PRODUCTENTERPRISENEVALUATION" Value="84" />
<Value Name="PRODUCTEMBEDDEDAUTOMOTIVE" Value="85" />
<Value Name="PRODUCTEMBEDDEDINDUSTRYA" Value="86" />
<Value Name="PRODUCTTHINPC" Value="87" />
<Value Name="PRODUCTEMBEDDEDA" Value="88" />
<Value Name="PRODUCTEMBEDDEDINDUSTRY" Value="89" />
<Value Name="PRODUCTEMBEDDEDE" Value="90" />
<Value Name="PRODUCTEMBEDDEDINDUSTRYE" Value="91" />
<Value Name="PRODUCTEMBEDDEDINDUSTRYAE" Value="92" />
<Value Name="PRODUCTSTORAGEWORKGROUPEVALUATIONSERVE" Value="95" />
<Value Name="PRODUCTSTORAGESTANDARDEVALUATIONSERVER" Value="96" />
<Value Name="PRODUCTCOREARM" Value="97" />
<Value Name="PRODUCTCOREN" Value="98" />
<Value Name="PRODUCTCORECOUNTRYSPECIFIC" Value="99" />
<Value Name="PRODUCTCORESINGLELANGUAGE" Value="100" />
<Value Name="PRODUCTCORE" Value="101" />
<Value Name="PRODUCTPROFESSIONALWMC" Value="103" />
<Value Name="PRODUCTEMBEDDEDINDUSTRYEVAL" Value="105" />
<Value Name="PRODUCTEMBEDDEDINDUSTRYEEVAL" Value="106" />
<Value Name="PRODUCTEMBEDDEDEVAL" Value="107" />
<Value Name="PRODUCTEMBEDDEDEEVAL" Value="108" />
<Value Name="PRODUCTNANOSERVER" Value="109" />
<Value Name="PRODUCTCLOUDSTORAGESERVER" Value="110" />
<Value Name="PRODUCTCORECONNECTED" Value="111" />
<Value Name="PRODUCTPROFESSIONALSTUDENT" Value="112" />
<Value Name="PRODUCTCORECONNECTEDN" Value="113" />
<Value Name="PRODUCTPROFESSIONALSTUDENTN" Value="114" />
<Value Name="PRODUCTCORECONNECTEDSINGLELANGUAGE" Value="115" />
<Value Name="PRODUCTCORECONNECTEDCOUNTRYSPECIFIC" Value="116" />
<Value Name="PRODUCTCONNECTEDCAR" Value="117" />
<Value Name="PRODUCTINDUSTRYHANDHELD" Value="118" />
<Value Name="PRODUCTPPIPRO" Value="119" />
<Value Name="PRODUCTARM64SERVER" Value="120" />
<Value Name="PRODUCTEDUCATION" Value="121" />
<Value Name="PRODUCTEDUCATIONN" Value="122" />
<Value Name="PRODUCTIOTUAP" Value="123" />
<Value Name="PRODUCTCLOUDHOSTINFRASTRUCTURESERVER" Value="124" />
<Value Name="PRODUCTENTERPRISES" Value="125" />
<Value Name="PRODUCTENTERPRISESN" Value="126" />
<Value Name="PRODUCTPROFESSIONALS" Value="127" />
<Value Name="PRODUCTPROFESSIONALSN" Value="128" />
<Value Name="PRODUCTENTERPRISESEVALUATION" Value="129" />
<Value Name="PRODUCTENTERPRISESNEVALUATION" Value="130" />
<Value Name="PRODUCTHOLOGRAPHIC" Value="135" />
<Value Name="PRODUCTPROSINGLELANGUAGE" Value="138" />
<Value Name="PRODUCTPROCHINA" Value="139" />
<Value Name="PRODUCTENTERPRISESUBSCRIPTION" Value="140" />
<Value Name="PRODUCTENTERPRISESUBSCRIPTIONN" Value="141" />
<Value Name="PRODUCTDATACENTERNANOSERVER" Value="143" />
<Value Name="PRODUCTSTANDARDNANOSERVER" Value="144" />
<Value Name="PRODUCTDATACENTERASERVERCORE" Value="145" />
<Value Name="PRODUCTSTANDARDASERVERCORE" Value="146" />
<Value Name="PRODUCTDATACENTERWSSERVERCORE" Value="147" />
<Value Name="PRODUCTSTANDARDWSSERVERCORE" Value="148" />
<Value Name="PRODUCTUTILITYVM" Value="149" />
<Value Name="PRODUCTDATACENTEREVALUATIONSERVERCORE" Value="159" />
<Value Name="PRODUCTSTANDARDEVALUATIONSERVERCORE" Value="160" />
<Value Name="PRODUCTPROWORKSTATION" Value="161" />
<Value Name="PRODUCTPROWORKSTATIONN" Value="162" />
<Value Name="PRODUCTPROFOREDUCATION" Value="164" />
<Value Name="PRODUCTPROFOREDUCATIONN" Value="165" />
<Value Name="PRODUCTAZURESERVERCORE" Value="168" />
<Value Name="PRODUCTAZURENANOSERVER" Value="169" />
<Value Name="PRODUCTENTERPRISEG" Value="171" />
<Value Name="PRODUCTENTERPRISEGN" Value="172" />
<Value Name="PRODUCTSERVERRDSH" Value="175" />
<Value Name="PRODUCTCLOUD" Value="178" />
<Value Name="PRODUCTCLOUDN" Value="179" />
<Value Name="PRODUCTHUBOS" Value="180" />
<Value Name="PRODUCTONECOREUPDATEOS" Value="182" />
<Value Name="PRODUCTCLOUDE" Value="183" />
<Value Name="PRODUCTANDROMEDA" Value="184" />
<Value Name="PRODUCTIOTOS" Value="185" />
<Value Name="PRODUCTCLOUDEN" Value="186" />
</Enum>
<Enum EnumName="Win32_OperatingSystem.OSProductSuite" UnderlyingType="system.uint32" BitwiseFlags="true">
<Value Name="SmallBusinessServer" Value="1" />
<Value Name="Server2008Enterprise" Value="2" />
<Value Name="BackOfficeComponents" Value="4" />
<Value Name="CommunicationsServer" Value="8" />
<Value Name="TerminalServices" Value="16" />
<Value Name="SmallBusinessServerRestricted" Value="32" />
<Value Name="WindowsEmbedded" Value="64" />
<Value Name="DatacenterEdition" Value="128" />
<Value Name="TerminalServicesSingleSession" Value="256" />
<Value Name="HomeEdition" Value="512" />
<Value Name="WebServerEdition" Value="1024" />
<Value Name="StorageServerEdition" Value="8192" />
<Value Name="ComputeClusterEdition" Value="16384" />
</Enum>
<Enum EnumName="Win32_OperatingSystem.OSType" UnderlyingType="system.uint16">
<Value Name="Unknown" Value="0" />
<Value Name="Other" Value="1" />
<Value Name="MacOS" Value="2" />
<Value Name="ATTUnix" Value="3" />
<Value Name="DGUnix" Value="4" />
<Value Name="DECNT" Value="5" />
<Value Name="DigitalUnix" Value="6" />
<Value Name="OpenVMS" Value="7" />
<Value Name="HPUnix" Value="8" />
<Value Name="AIX" Value="9" />
<Value Name="MVS" Value="10" />
<Value Name="OS400" Value="11" />
<Value Name="OS2" Value="12" />
<Value Name="JavaVM" Value="13" />
<Value Name="MSDOS" Value="14" />
<Value Name="Windows3x" Value="15" />
<Value Name="Windows95" Value="16" />
<Value Name="Windows98" Value="17" />
<Value Name="WindowsNT" Value="18" />
<Value Name="WindowsCE" Value="19" />
<Value Name="NCR3000" Value="20" />
<Value Name="NetWare" Value="21" />
<Value Name="OSF" Value="22" />
<Value Name="DCOS" Value="23" />
<Value Name="ReliantUNIX" Value="24" />
<Value Name="SCOUnixWare" Value="25" />
<Value Name="SCOOpenServer" Value="26" />
<Value Name="Sequent" Value="27" />
<Value Name="IRIX" Value="28" />
<Value Name="Solaris" Value="29" />
<Value Name="SunOS" Value="30" />
<Value Name="U6000" Value="31" />
<Value Name="ASERIES" Value="32" />
<Value Name="TandemNSK" Value="33" />
<Value Name="TandemNT" Value="34" />
<Value Name="BS2000" Value="35" />
<Value Name="LINUX" Value="36" />
<Value Name="Lynx" Value="37" />
<Value Name="XENIX" Value="38" />
<Value Name="VMESA" Value="39" />
<Value Name="InteractiveUnix" Value="40" />
<Value Name="BSDUnix" Value="41" />
<Value Name="FreeBSD" Value="42" />
<Value Name="NetBSD" Value="43" />
<Value Name="GNUHurd" Value="44" />
<Value Name="OS9" Value="45" />
<Value Name="MACHKernel" Value="46" />
<Value Name="Inferno" Value="47" />
<Value Name="QNX" Value="48" />
<Value Name="EPOC" Value="49" />
<Value Name="IxWorks" Value="50" />
<Value Name="VxWorks" Value="51" />
<Value Name="MiNT" Value="52" />
<Value Name="BeOS" Value="53" />
<Value Name="HPMPE" Value="54" />
<Value Name="NextStep" Value="55" />
<Value Name="PalmPilot" Value="56" />
<Value Name="Rhapsody" Value="57" />
<Value Name="Windows2000" Value="58" />
<Value Name="Dedicated" Value="59" />
<Value Name="OS390" Value="60" />
<Value Name="VSE" Value="61" />
<Value Name="TPF" Value="62" />
</Enum>
<Enum EnumName="Win32_OperatingSystem.ProductType" UnderlyingType="system.uint32">
<Value Name="Workstation" Value="1" />
<Value Name="DomainController" Value="2" />
<Value Name="Server" Value="3" />
</Enum>
<Enum EnumName="Win32_OperatingSystem.SuiteMask" UnderlyingType="system.uint32" BitwiseFlags="true">
<Value Name="SmallBusinessServer" Value="1" />
<Value Name="Server2008Enterprise" Value="2" />
<Value Name="BackOfficeComponents" Value="4" />
<Value Name="CommunicationsServer" Value="8" />
<Value Name="TerminalServices" Value="16" />
<Value Name="SmallBusinessServerRestricted" Value="32" />
<Value Name="WindowsEmbedded" Value="64" />
<Value Name="DatacenterEdition" Value="128" />
<Value Name="TerminalServicesSingleSession" Value="256" />
<Value Name="HomeEdition" Value="512" />
<Value Name="WebServerEdition" Value="1024" />
<Value Name="StorageServerEdition" Value="8192" />
<Value Name="ComputeClusterEdition" Value="16384" />
</Enum>
</Enums>
</PowerShellMetadata>
'@ | Set-Content -LiteralPath $cdxmlPath -Encoding UTF8
# import module
Import-Module -Name $cdxmlPath -Force -Verbose
# list new cmdlets
Get-Command -Module "Win32_OperatingSystem"
Type Extensions for PowerShell
You can automatically improve properties of class instances by using a types.ps1xml file.
Create Win32_OperatingSystem.Types.ps1xml
$folder = "c:\wmi\Win32_OperatingSystem"
$typesPath = Join-Path -Path $folder -ChildPath "Win32_OperatingSystem.Types.ps1xml"
# create folder if not present:
$exists = Test-Path -Path $folder
if (!$exists) { $null = New-Item -Path $folder -ItemType Directory }
# write file
$content = @'
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is licensed under 'Attribution 4.0 International' license (https://creativecommons.org/licenses/by/4.0/).
You can free of charge use this code in commercial and non-commercial code, and you can freely modify and adjust the code
as long as you give appropriate credit to the original author Dr. Tobias Weltner.
This material was published and is maintained here:
https://powershell.one/wmi/root/cimv2/win32_operatingsystem#typesps1xml-file
-->
<Types>
<Type>
<!--@
Applicable type. This type is produced by Get-CimInstance.
To extend instances produced by Get-WmiObject, change the type name to:
System.Management.ManagementObject#root/cimv2\Win32_OperatingSystem
@-->
<Name>Microsoft.Management.Infrastructure.CimInstance#Root/CIMV2/Win32_OperatingSystem</Name>
<Members>
<ScriptProperty>
<Name>DataExecutionPrevention_SupportPolicy</Name>
<!--casting raw content to a enum. This translates numeric values to friendly text while leaving the original property value untouched:-->
<GetScriptBlock>[Microsoft.PowerShell.Cmdletization.GeneratedTypes.Win32_OperatingSystem.DataExecutionPrevention_SupportPolicy]($this.PSBase.CimInstanceProperties['DataExecutionPrevention_SupportPolicy'].Value)</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>ForegroundApplicationBoost</Name>
<!--casting raw content to a enum. This translates numeric values to friendly text while leaving the original property value untouched:-->
<GetScriptBlock>[Microsoft.PowerShell.Cmdletization.GeneratedTypes.Win32_OperatingSystem.ForegroundApplicationBoost]($this.PSBase.CimInstanceProperties['ForegroundApplicationBoost'].Value)</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>FreePhysicalMemory</Name>
<!--overwriting ToString() method to provide formatted output while leaving the original property value untouched:-->
<GetScriptBlock>($this.PSBase.CimInstanceProperties['FreePhysicalMemory'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>FreeSpaceInPagingFiles</Name>
<!--overwriting ToString() method to provide formatted output while leaving the original property value untouched:-->
<GetScriptBlock>($this.PSBase.CimInstanceProperties['FreeSpaceInPagingFiles'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>FreeVirtualMemory</Name>
<!--overwriting ToString() method to provide formatted output while leaving the original property value untouched:-->
<GetScriptBlock>($this.PSBase.CimInstanceProperties['FreeVirtualMemory'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>Locale</Name>
<!--converting raw content to a better .NET type:-->
<GetScriptBlock>[System.Globalization.CultureInfo][Convert]::ToInt32(($this.PSBase.CimInstanceProperties['Locale'].Value),16)</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>MaxProcessMemorySize</Name>
<!--overwriting ToString() method to provide formatted output while leaving the original property value untouched:-->
<GetScriptBlock>($this.PSBase.CimInstanceProperties['MaxProcessMemorySize'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>OperatingSystemSKU</Name>
<!--casting raw content to a enum. This translates numeric values to friendly text while leaving the original property value untouched:-->
<GetScriptBlock>[Microsoft.PowerShell.Cmdletization.GeneratedTypes.Win32_OperatingSystem.OperatingSystemSKU]($this.PSBase.CimInstanceProperties['OperatingSystemSKU'].Value)</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>OSLanguage</Name>
<!--converting raw content to a better .NET type:-->
<GetScriptBlock>[System.Globalization.CultureInfo][int]($this.PSBase.CimInstanceProperties['OSLanguage'].Value)</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>OSProductSuite</Name>
<!--casting raw content to a flags enum. This translates bitmask to friendly text while leaving the original property value untouched:-->
<GetScriptBlock>[Microsoft.PowerShell.Cmdletization.GeneratedTypes.Win32_OperatingSystem.OSProductSuite]($this.PSBase.CimInstanceProperties['OSProductSuite'].Value)</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>OSType</Name>
<!--casting raw content to a enum. This translates numeric values to friendly text while leaving the original property value untouched:-->
<GetScriptBlock>[Microsoft.PowerShell.Cmdletization.GeneratedTypes.Win32_OperatingSystem.OSType]($this.PSBase.CimInstanceProperties['OSType'].Value)</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>ProductType</Name>
<!--casting raw content to a enum. This translates numeric values to friendly text while leaving the original property value untouched:-->
<GetScriptBlock>[Microsoft.PowerShell.Cmdletization.GeneratedTypes.Win32_OperatingSystem.ProductType]($this.PSBase.CimInstanceProperties['ProductType'].Value)</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>SizeStoredInPagingFiles</Name>
<!--overwriting ToString() method to provide formatted output while leaving the original property value untouched:-->
<GetScriptBlock>($this.PSBase.CimInstanceProperties['SizeStoredInPagingFiles'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>SuiteMask</Name>
<!--casting raw content to a flags enum. This translates bitmask to friendly text while leaving the original property value untouched:-->
<GetScriptBlock>[Microsoft.PowerShell.Cmdletization.GeneratedTypes.Win32_OperatingSystem.SuiteMask]($this.PSBase.CimInstanceProperties['SuiteMask'].Value)</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>TotalSwapSpaceSize</Name>
<!--overwriting ToString() method to provide formatted output while leaving the original property value untouched:-->
<GetScriptBlock>($this.PSBase.CimInstanceProperties['TotalSwapSpaceSize'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>TotalVirtualMemorySize</Name>
<!--overwriting ToString() method to provide formatted output while leaving the original property value untouched:-->
<GetScriptBlock>($this.PSBase.CimInstanceProperties['TotalVirtualMemorySize'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>TotalVisibleMemorySize</Name>
<!--overwriting ToString() method to provide formatted output while leaving the original property value untouched:-->
<GetScriptBlock>($this.PSBase.CimInstanceProperties['TotalVisibleMemorySize'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>Version</Name>
<!--converting raw content to a better .NET type:-->
<GetScriptBlock>[Version]($this.PSBase.CimInstanceProperties['Version'].Value)</GetScriptBlock>
</ScriptProperty>
</Members>
</Type>
</Types>
'@ | Set-Content -LiteralPath $typesPath -Encoding UTF8
# import type definition
Update-TypeData -PrependPath $typesPath
Note: Win32_OperatingSystem.Types.ps1xml is using enumerations defined in ClassName.cdxml which are available only when you imported the .cdxml file via
Import-Module
.
Or, you can manually update the PowerShell type database using Update-TypeData
.
View Update-TypeData
commands for Win32_OperatingSystem properties
Update-TypeData -MemberName DataExecutionPrevention_SupportPolicy -TypeName "Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem" -MemberType ScriptProperty -Value {
Enum EnumDataExecutionPrevention_SupportPolicy
{
Always_Off = 0
Always_On = 1
Opt_In = 2
Opt_Out = 3
}
[EnumDataExecutionPrevention_SupportPolicy]($this.PSBase.CimInstanceProperties['DataExecutionPrevention_SupportPolicy'].Value)
} -Force
Update-TypeData -MemberName ForegroundApplicationBoost -TypeName "Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem" -MemberType ScriptProperty -Value {
Enum EnumForegroundApplicationBoost
{
None = 0
Minimum = 1
Maximum = 2
}
[EnumForegroundApplicationBoost]($this.PSBase.CimInstanceProperties['ForegroundApplicationBoost'].Value)
} -Force
Update-TypeData -MemberName FreePhysicalMemory -TypeName 'Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem' -MemberType ScriptProperty -Value { ($this.PSBase.CimInstanceProperties['FreePhysicalMemory'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru } -Force
Update-TypeData -MemberName FreeSpaceInPagingFiles -TypeName 'Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem' -MemberType ScriptProperty -Value { ($this.PSBase.CimInstanceProperties['FreeSpaceInPagingFiles'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru } -Force
Update-TypeData -MemberName FreeVirtualMemory -TypeName 'Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem' -MemberType ScriptProperty -Value { ($this.PSBase.CimInstanceProperties['FreeVirtualMemory'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru } -Force
Update-TypeData -MemberName Locale -TypeName 'Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem' -MemberType ScriptProperty -Value { [System.Globalization.CultureInfo][Convert]::ToInt32(($this.PSBase.CimInstanceProperties['Locale'].Value),16) } -Force
Update-TypeData -MemberName MaxProcessMemorySize -TypeName 'Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem' -MemberType ScriptProperty -Value { ($this.PSBase.CimInstanceProperties['MaxProcessMemorySize'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru } -Force
Update-TypeData -MemberName OperatingSystemSKU -TypeName "Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem" -MemberType ScriptProperty -Value {
Enum EnumOperatingSystemSKU
{
PRODUCT_UNDEFINED = 0
PRODUCT_ULTIMATE = 1
PRODUCT_HOME_BASIC = 2
PRODUCT_HOME_PREMIUM = 3
PRODUCT_ENTERPRISE = 4
PRODUCT_HOME_BASIC_N = 5
PRODUCT_BUSINESS = 6
PRODUCT_STANDARD_SERVER = 7
PRODUCT_DATACENTER_SERVER = 8
PRODUCT_SMALLBUSINESS_SERVER = 9
PRODUCT_ENTERPRISE_SERVER = 10
PRODUCT_STARTER = 11
PRODUCT_DATACENTER_SERVER_CORE = 12
PRODUCT_STANDARD_SERVER_CORE = 13
PRODUCT_ENTERPRISE_SERVER_CORE = 14
PRODUCT_ENTERPRISE_SERVER_IA64 = 15
PRODUCT_BUSINESS_N = 16
PRODUCT_WEB_SERVER = 17
PRODUCT_CLUSTER_SERVER = 18
PRODUCT_HOME_SERVER = 19
PRODUCT_STORAGE_EXPRESS_SERVER = 20
PRODUCT_STORAGE_STANDARD_SERVER = 21
PRODUCT_STORAGE_WORKGROUP_SERVER = 22
PRODUCT_STORAGE_ENTERPRISE_SERVER = 23
PRODUCT_SERVER_FOR_SMALLBUSINESS = 24
PRODUCT_SMALLBUSINESS_SERVER_PREMIUM = 25
PRODUCT_HOME_PREMIUM_N = 26
PRODUCT_ENTERPRISE_N = 27
PRODUCT_ULTIMATE_N = 28
PRODUCT_WEB_SERVER_CORE = 29
PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT = 30
PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY = 31
PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING = 32
PRODUCT_SERVER_FOUNDATION = 33
PRODUCT_HOME_PREMIUM_SERVER = 34
PRODUCT_SERVER_FOR_SMALLBUSINESS_V = 35
PRODUCT_STANDARD_SERVER_V = 36
PRODUCT_DATACENTER_SERVER_V = 37
PRODUCT_ENTERPRISE_SERVER_V = 38
PRODUCT_DATACENTER_SERVER_CORE_V = 39
PRODUCT_STANDARD_SERVER_CORE_V = 40
PRODUCT_ENTERPRISE_SERVER_CORE_V = 41
PRODUCT_HYPERV = 42
PRODUCT_STORAGE_EXPRESS_SERVER_CORE = 43
PRODUCT_STORAGE_STANDARD_SERVER_CORE = 44
PRODUCT_STORAGE_WORKGROUP_SERVER_CORE = 45
PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE = 46
PRODUCT_STARTER_N = 47
PRODUCT_PROFESSIONAL = 48
PRODUCT_PROFESSIONAL_N = 49
PRODUCT_SB_SOLUTION_SERVER = 50
PRODUCT_SERVER_FOR_SB_SOLUTIONS = 51
PRODUCT_STANDARD_SERVER_SOLUTIONS = 52
PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE = 53
PRODUCT_SB_SOLUTION_SERVER_EM = 54
PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM = 55
PRODUCT_SOLUTION_EMBEDDEDSERVER = 56
PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE = 57
PRODUCT_PROFESSIONAL_EMBEDDED = 58
PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT = 59
PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL = 60
PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC = 61
PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC = 62
PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE = 63
PRODUCT_CLUSTER_SERVER_V = 64
PRODUCT_EMBEDDED = 65
PRODUCT_STARTER_E = 66
PRODUCT_HOME_BASIC_E = 67
PRODUCT_HOME_PREMIUM_E = 68
PRODUCT_PROFESSIONAL_E = 69
PRODUCT_ENTERPRISE_E = 70
PRODUCT_ULTIMATE_E = 71
PRODUCT_ENTERPRISE_EVALUATION = 72
PRODUCT_MULTIPOINT_STANDARD_SERVER = 76
PRODUCT_MULTIPOINT_PREMIUM_SERVER = 77
PRODUCT_STANDARD_EVALUATION_SERVER = 79
PRODUCT_DATACENTER_EVALUATION_SERVER = 80
PRODUCT_ENTERPRISE_N_EVALUATION = 84
PRODUCT_EMBEDDED_AUTOMOTIVE = 85
PRODUCT_EMBEDDED_INDUSTRY_A = 86
PRODUCT_THINPC = 87
PRODUCT_EMBEDDED_A = 88
PRODUCT_EMBEDDED_INDUSTRY = 89
PRODUCT_EMBEDDED_E = 90
PRODUCT_EMBEDDED_INDUSTRY_E = 91
PRODUCT_EMBEDDED_INDUSTRY_A_E = 92
PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVE = 95
PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER = 96
PRODUCT_CORE_ARM = 97
PRODUCT_CORE_N = 98
PRODUCT_CORE_COUNTRYSPECIFIC = 99
PRODUCT_CORE_SINGLELANGUAGE = 100
PRODUCT_CORE = 101
PRODUCT_PROFESSIONAL_WMC = 103
PRODUCT_EMBEDDED_INDUSTRY_EVAL = 105
PRODUCT_EMBEDDED_INDUSTRY_E_EVAL = 106
PRODUCT_EMBEDDED_EVAL = 107
PRODUCT_EMBEDDED_E_EVAL = 108
PRODUCT_NANO_SERVER = 109
PRODUCT_CLOUD_STORAGE_SERVER = 110
PRODUCT_CORE_CONNECTED = 111
PRODUCT_PROFESSIONAL_STUDENT = 112
PRODUCT_CORE_CONNECTED_N = 113
PRODUCT_PROFESSIONAL_STUDENT_N = 114
PRODUCT_CORE_CONNECTED_SINGLELANGUAGE = 115
PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC = 116
PRODUCT_CONNECTED_CAR = 117
PRODUCT_INDUSTRY_HANDHELD = 118
PRODUCT_PPI_PRO = 119
PRODUCT_ARM64_SERVER = 120
PRODUCT_EDUCATION = 121
PRODUCT_EDUCATION_N = 122
PRODUCT_IOTUAP = 123
PRODUCT_CLOUD_HOST_INFRASTRUCTURE_SERVER = 124
PRODUCT_ENTERPRISE_S = 125
PRODUCT_ENTERPRISE_S_N = 126
PRODUCT_PROFESSIONAL_S = 127
PRODUCT_PROFESSIONAL_S_N = 128
PRODUCT_ENTERPRISE_S_EVALUATION = 129
PRODUCT_ENTERPRISE_S_N_EVALUATION = 130
PRODUCT_HOLOGRAPHIC = 135
PRODUCT_PRO_SINGLE_LANGUAGE = 138
PRODUCT_PRO_CHINA = 139
PRODUCT_ENTERPRISE_SUBSCRIPTION = 140
PRODUCT_ENTERPRISE_SUBSCRIPTION_N = 141
PRODUCT_DATACENTER_NANO_SERVER = 143
PRODUCT_STANDARD_NANO_SERVER = 144
PRODUCT_DATACENTER_A_SERVER_CORE = 145
PRODUCT_STANDARD_A_SERVER_CORE = 146
PRODUCT_DATACENTER_WS_SERVER_CORE = 147
PRODUCT_STANDARD_WS_SERVER_CORE = 148
PRODUCT_UTILITY_VM = 149
PRODUCT_DATACENTER_EVALUATION_SERVER_CORE = 159
PRODUCT_STANDARD_EVALUATION_SERVER_CORE = 160
PRODUCT_PRO_WORKSTATION = 161
PRODUCT_PRO_WORKSTATION_N = 162
PRODUCT_PRO_FOR_EDUCATION = 164
PRODUCT_PRO_FOR_EDUCATION_N = 165
PRODUCT_AZURE_SERVER_CORE = 168
PRODUCT_AZURE_NANO_SERVER = 169
PRODUCT_ENTERPRISEG = 171
PRODUCT_ENTERPRISEGN = 172
PRODUCT_SERVERRDSH = 175
PRODUCT_CLOUD = 178
PRODUCT_CLOUDN = 179
PRODUCT_HUBOS = 180
PRODUCT_ONECOREUPDATEOS = 182
PRODUCT_CLOUDE = 183
PRODUCT_ANDROMEDA = 184
PRODUCT_IOTOS = 185
PRODUCT_CLOUDEN = 186
}
[EnumOperatingSystemSKU]($this.PSBase.CimInstanceProperties['OperatingSystemSKU'].Value)
} -Force
Update-TypeData -MemberName OSLanguage -TypeName 'Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem' -MemberType ScriptProperty -Value { [System.Globalization.CultureInfo][int]($this.PSBase.CimInstanceProperties['OSLanguage'].Value) } -Force
Update-TypeData -MemberName OSProductSuite -TypeName "Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem" -MemberType ScriptProperty -Value {
[Flags()] Enum EnumOSProductSuite
{
SmallBusinessServer = 1
Server2008Enterprise = 2
BackOfficeComponents = 4
CommunicationsServer = 8
TerminalServices = 16
SmallBusinessServerRestricted = 32
WindowsEmbedded = 64
DatacenterEdition = 128
TerminalServicesSingleSession = 256
HomeEdition = 512
WebServerEdition = 1024
StorageServerEdition = 8192
ComputeClusterEdition = 16384
}
[EnumOSProductSuite]($this.PSBase.CimInstanceProperties['OSProductSuite'].Value)
} -Force
Update-TypeData -MemberName OSType -TypeName "Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem" -MemberType ScriptProperty -Value {
Enum EnumOSType
{
Unknown = 0
Other = 1
MacOS = 2
ATTUnix = 3
DGUnix = 4
DECNT = 5
Digital_Unix = 6
OpenVMS = 7
HPUnix = 8
AIX = 9
MVS = 10
OS400 = 11
OS2 = 12
JavaVM = 13
MSDOS = 14
Windows3x = 15
Windows95 = 16
Windows98 = 17
WindowsNT = 18
WindowsCE = 19
NCR3000 = 20
NetWare = 21
OSF = 22
DCOS = 23
ReliantUNIX = 24
SCOUnixWare = 25
SCOOpenServer = 26
Sequent = 27
IRIX = 28
Solaris = 29
SunOS = 30
U6000 = 31
ASERIES = 32
TandemNSK = 33
TandemNT = 34
BS2000 = 35
LINUX = 36
Lynx = 37
XENIX = 38
VMESA = 39
Interactive_Unix = 40
BSDUnix = 41
FreeBSD = 42
NetBSD = 43
GNU_Hurd = 44
OS9 = 45
MACH_Kernel = 46
Inferno = 47
QNX = 48
EPOC = 49
IxWorks = 50
VxWorks = 51
MiNT = 52
BeOS = 53
HP_MPE = 54
NextStep = 55
PalmPilot = 56
Rhapsody = 57
Windows_2000 = 58
Dedicated = 59
OS390 = 60
VSE = 61
TPF = 62
}
[EnumOSType]($this.PSBase.CimInstanceProperties['OSType'].Value)
} -Force
Update-TypeData -MemberName ProductType -TypeName "Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem" -MemberType ScriptProperty -Value {
Enum EnumProductType
{
Workstation = 1
DomainController = 2
Server = 3
}
[EnumProductType]($this.PSBase.CimInstanceProperties['ProductType'].Value)
} -Force
Update-TypeData -MemberName SizeStoredInPagingFiles -TypeName 'Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem' -MemberType ScriptProperty -Value { ($this.PSBase.CimInstanceProperties['SizeStoredInPagingFiles'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru } -Force
Update-TypeData -MemberName SuiteMask -TypeName "Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem" -MemberType ScriptProperty -Value {
[Flags()] Enum EnumSuiteMask
{
SmallBusinessServer = 1
Server2008Enterprise = 2
BackOfficeComponents = 4
CommunicationsServer = 8
TerminalServices = 16
SmallBusinessServerRestricted = 32
WindowsEmbedded = 64
DatacenterEdition = 128
TerminalServicesSingleSession = 256
HomeEdition = 512
WebServerEdition = 1024
StorageServerEdition = 8192
ComputeClusterEdition = 16384
}
[EnumSuiteMask]($this.PSBase.CimInstanceProperties['SuiteMask'].Value)
} -Force
Update-TypeData -MemberName TotalSwapSpaceSize -TypeName 'Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem' -MemberType ScriptProperty -Value { ($this.PSBase.CimInstanceProperties['TotalSwapSpaceSize'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru } -Force
Update-TypeData -MemberName TotalVirtualMemorySize -TypeName 'Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem' -MemberType ScriptProperty -Value { ($this.PSBase.CimInstanceProperties['TotalVirtualMemorySize'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru } -Force
Update-TypeData -MemberName TotalVisibleMemorySize -TypeName 'Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem' -MemberType ScriptProperty -Value { ($this.PSBase.CimInstanceProperties['TotalVisibleMemorySize'].Value) | Add-Member -MemberType ScriptMethod -Name ToString -Force -Value { "{0:n2} GB" -f ($this/1MB) } -PassThru } -Force
Update-TypeData -MemberName Version -TypeName 'Microsoft.Management.Infrastructure.CimInstance#root/cimv2/win32_operatingsystem' -MemberType ScriptProperty -Value { [Version]($this.PSBase.CimInstanceProperties['Version'].Value) } -Force
Note: Win32_OperatingSystem.Types.ps1xml is using enumerations defined in ClassName.cdxml which are available only when you imported the .cdxml file via
Import-Module
.
See Also
Associated Classes:
Requirements
To use Win32_OperatingSystem, the following requirements apply:
PowerShell
Get-CimInstance
was introduced with PowerShell Version 3.0, which in turn was introduced on clients with Windows 8 and on servers with Windows Server 2012.
If necessary, update Windows PowerShell to Windows PowerShell 5.1, or install PowerShell 7 side-by-side.
Operating System
Win32_OperatingSystem was introduced on clients with Windows Vista and on servers with Windows Server 2008.
Namespace
Win32_OperatingSystem lives in the namespace root/cimv2. This is the default namespace. There is no need to use the -Namespace parameter in Get-CimInstance
.
Implementation
Win32_OperatingSystem is implemented in CIMWin32.dll and defined in CIMWin32.mof. Both files are located in the folder C:\Windows\system32\wbem
:
explorer $env:windir\system32\wbem
notepad $env:windir\system32\wbem\CIMWin32.mof