W2KSG: Operating System
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.


Read the complete post at http://richardsiddaway.spaces.live.com/Blog/cns!43CFA46A74CF3E96!1781.entry