To more easily modify the Where clause in a script, substitute the Where clause with a variable. This configuration can be modified to include command-line input as well. This is shown in the ListSpecificWhere.ps1 script.
ListSpecificWhere.ps1
$strComputer = "." $wmiNS = "root\cimv2" $strWhere = "'ipc$'" $wmiQuery = "Select * from win32_Share where name="+$strWhere "Properties of Share named: " + $strWhere $objWMIServices = Get-WmiObject -computer $strComputer ` -namespace $wmiNS -query $wmiQuery $objWMIServices | Format-List -property [a-z]*
Q. To limit the specific data returned by a query, what WQL technique can be utilized?
A. The Where clause of the WMIquery argument is very powerful in limiting the specific data returned by a query.
Q. What are three possible operators that can be employed in creating powerful Where clauses?
A. The equals sign (=) and the greater than (>) and the less than (<) symbols can be used to evaluate the data before returning the dataset.