Use WMI and WQL!

by Jan 19, 2012

WMI is a great information resource, and Get-WmiObject makes it easy to retrieve WMI instances. First, use -List parameter to find WMI class names. For example, find classes that deal with network:

Get-WmiObject -List Win32_*network*

Next, pick one of the classes and enumerate its instances:

Get-WmiObject Win32_NetworkAdapterConfiguration

With WQL, a SQL-type query language for WMI, you can even create more sophisticated queries, such as:

Get-WmiObject -Query 'Select * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=True'

To learn more about the specific WQL format and the keywords you can use, check this reference: http://msdn.microsoft.com/en-us/library/windows/desktop/aa394606(v=vs.85).aspx

Twitter This Tip!
ReTweet this Tip!