O'Reilly logo

Windows PowerShell™ 3.0 Step by Step by Ed Wilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Retrieving WMI instances

To query for WMI data, use the Get-CimInstance cmdlet. The easiest way to use the Get-CimInstance cmdlet is to query for all properties and all instances of a particular WMI class on the local machine. This is extremely easy to do. The following command illustrates returning BIOS information from the local computer:

PS C:\> Get-CimInstance win32_bios


SMBIOSBIOSVersion : 090004
Manufacturer      : American Megatrends Inc.
Name              : BIOS Date: 03/19/09 22:51:32  Ver: 09.00.04
SerialNumber      : 4429-0046-2083-1237-7579-8937-43
Version           : VRTUAL - 3000919

The Get-CimInstance cmdlet returns the entire WMI object, but it honors the *.format.ps1xml files that Windows PowerShell uses to determine which properties are displayed by default ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required