PDQ.com mobilePDQ.com desktop

Using PowerShell to extract WMI values

Shane CorellianShane Corellian

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

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

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

Did you know that PDQ Deploy has a PowerShell step you can use to deploy your scripts?

This blog post is part of a series on PowerShell:

Ready to get started?

Take our 14-day Free Trial.
This round is on us!

Don't miss the next post!

Using PowerShell to Install Printers

When installing printers, we will need to do the four things; Add Driver to the Store, Install the Driver, Create Printer Port, and Install the Printer