PowerTip: Find all Format*xml Files Referencing WMI Class

Doctor Scripto

Summary: Find all Format*xml files that contain references to specific WMI class.

Hey, Scripting Guy! Question I am trying to find why a particular WMI class returns a subset of properties. I suspect output is controlled by an
           entry in one of the Format*xml files, so how can I use Windows PowerShell to easily find which file contains
           the formatting information?

Hey, Scripting Guy! Answer Use the Get-ChildItem cmdlet to list the files in $pshome. Then use Select-String to search for the
           WMI class name. To clean up the output, select only the unique paths that return.
           Here is an example (this is a one-line command that has wrapped):

Select-String -Pattern win32_computersystem -Path ((ls $PSHOME).fullname)
-SimpleMatch -ea 0 | select-object path -Unique

0 comments

Discussion is closed.

Feedback usabilla icon