header image

W2KSG: Operating System

Posted by: | September 29, 2008 | No Comment |

The other area we have to dig into when inventorying systems is the OS.  WMI has a class just for this

PS> Get-WmiObject -Class Win32_OperatingSystem

SystemDirectory : C:\Windows\system32
Organization    :
BuildNumber     : 6001
RegisteredUser  : admin
SerialNumber    : 55041-037-8508545-71489
Version         : 6.0.6001

This doesn’t give us everything we might wish for.  The default formatter is a play here in that it decides what should be displayed if you don’t choose.  To see what is available try

Get-WmiObject -Class Win32_OperatingSystem | Select *

which will display all properties.  If we want to be a bit more selective lets try

Listing 8.7

Get-WmiObject -Class Win32_OperatingSystem | Select BootDevice, BuildNumber,BuildType, Caption, Codeset, CountryCode, Debug, InstallDate, NumberofLicensedUsers, Organization, OSLanguage, OSProductSuite, OSType, Primary, RegisteredUser, SerialNumber, Version

These scripts illustrate one of the most difficult aspects of WMI – knowing what is available.


Share this post :


Technorati Tags: ,

under: PowerShell and WMI