24/7/365 Support

Program: Determine Properties Available to WMI Filters

When you want to access a specific WMI instance with PowerShell’s [Wmi] type shortcut, you might at first struggle to determine what properties WMI lets you search on. These properties are called key properties on the class. Example 151 gets all the properties you may use in a WMI filter for a given class.

Example 151. GetWmiClassKeyProperty.ps1

############################################################################## ## ## GetWmiClassKeyProperty.ps1 ## ## Get all of the properties that you may use in a WMI filter for a given class. ## ## ie: ## ## PS >GetWmiClassKeyProperty Win32_Process ## ##############################################################################

param( [WmiClass] $wmiClass )

## WMI classes have properties foreach($currentProperty in $wmiClass.PsBase.Properties) {

## WMI properties have qualifiers to explain more about them foreach($qualifier in $currentProperty.Qualifiers) {

## If it has a 'Key' qualifier, then you may use it in a filter if($qualifier.Name eq "Key") {

$currentProperty.Name } } }

Help Category:

Get Windows Dedicated Server

Only reading will not help you, you have to practice it! So get it now.

Processor RAM Storage Server Detail
Intel Atom C2350 1.7 GHz 2c/2t 4 GB DDR3 1× 1 TB (HDD SATA) Configure Server
Intel Atom C2350 1.7 GHz 2c/2t 4 GB DDR3 1× 128 GB (SSD SATA) Configure Server
Intel Atom C2750 2.4 GHz 8c/8t 8 GB DDR3 1× 1 TB (HDD SATA) Configure Server
Intel Xeon E3-1230 v2 3.3 GHz 4c/8t 16 GB DDR3 1× 256 GB (SSD SATA) Configure Server
Intel Atom C2350 1.7 GHz 2c/2t 4 GB DDR3 1× 250 GB (SSD SATA) Configure Server

What Our Clients Say