Using PowerShell to extract WMI values

 

If you aren’t using Windows 7 and you haven’t installed Windows PowerShell yet, then go here to download and install.

Here are a couple of useful PowerShell examples for common tasks:

Example of Extracting the Total Physical Memory from WMI - Admin Arsenal
Example of Extracting the Total Physical Memory from WMI
Use PowerShell to directly query WMI | Admin Arsenal
Use PowerShell to directly query WMI

The two examples above show how you can use the “-filter” cmdlet to narrow down the results. In this case we filtered out any device where the DeviceId wasn’t “C:”. The second example shows how you can pass a WMI query using the “-query” cmdlet. In this case we only returned disks that are registered as Fixed Disks (“DriveType = 3″)

You can also query remote computers | Admin Arsenal
You can also query remote computers

Using the “-ComputerName” cmdlet you can specify a remote system. This should work for any object under the “get-WmiObject” cmdlet.