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:Windowssystem32
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: ,

About these ads
This entry was posted in PowerShell and WMI. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s