Topics for PowerShell WMI Win32ComputerSystem

WMI Perspective

Whenever I work with WMI it reminds me that the operating system must know everything that’s going on! Therefore, provided the PowerShell script has sufficient rights, it can use WMI and tap into that vast fountain of operating system knowledge. I think of WMI as a database, which keeps information about a computer’s components such as PCSystemType and DomainRole.

Get-WmiObject is the key command. As we will see, the class Win32_Computer holds a rich source of data about the computer, much of which is not displayed in the System Icon in the control panel, or any other GUI.

Note 1: Provided Win32_ComputerSystem follows directly after Get-WmiObject you can omit -class because PowerShell assumes the first word is a WMI class.

Problem: The above script does not display many properties.Solution: Employ [WMI] or Get-Member see below…

Guy Recommends: Free WMI Monitor for PowerShell

Windows Management Instrumentation (WMI) is one of the hidden treasures of Microsoft’s operating systems. Fortunately, SolarWinds have created a Free WMI Monitor so that you can discover these gems of performance information, and thus improve your PowerShell scripts.

Take the guess work out of which WMI counters to use when scripting the operating system, Active Directory, or Exchange Server. Give this WMI monitor a try – it’s free.

The idea of the following script is to interrogate the operating system for information about the Domain Role (Standalone or Member) and PC System Type (Laptop or Desktop). Once again, Win32ComputerSystem is the crucial WMI class.

SolarWinds’ Network Performance Monitor will help you discover what’s happening on your network. This utility will also guide you through troubleshooting; the dashboard will indicate whether the root cause is a broken link, faulty equipment or resource overload.

What I like best is the way NPM suggests solutions to network problems. Its also has the ability to monitor the health of individual VMware virtual machines. If you are interested in troubleshooting, and creating network maps, then I recommend that you try NPM now.

Learning Points

Note 1: The tiny backtick (`) tells PowerShell that the command continues on the next line.

Note 2: On other pages I use plain ‘Where’, or even ‘?’ instead of the full ‘Where-Object’.

Note 3: I expect you have guessed that PowerShell commands are case insensitive. At present I am not sure which is best, WmiObject, wmiObject or WmiObject – they all produce the same results. Another minor point, since the verb ‘get’ is the default, you can shorten the command to: WmiObject Win32_computersystem. Or if you like aliases: gwmi Win32_computersystem.

»

Summary of PowerShell WMI Win32_ComputerSystem

The PowerShell WMI class Win32ComputerSystem reveals properties such as PCSystemType and DomainRole. You can use PowerShell to display information about these and many other computer properties.