PowerTip: Use Tab to Complete WMI Class Names

Doctor Scripto

Summary: Use Tab completion to type WMI class names in Windows PowerShell.

Hey, Scripting Guy! Question I am using WMI in the Windows PowerShell console and in the Windows PowerShell ISE, and I am having a hard time
           correctly typing the long convoluted class names. How can I simplify the process and be more accurate?

Hey, Scripting Guy! AnswerUse the Get-CimInstance cmdlet instead of the Get-WmiObject cmdlet. One advantage (among many) of the 
           Get-CimInstance cmdlet is that it will do Tab completion on WMI class names.
           (The alias for Get-CimInstance cmdlet is GCIM.)

GCIM <tab> #
(cycles through the WMI classes in the default root\cimv2 WMI namespace)

GCIM Win32_P<tab> #
(cycles through WMI class names beginning with the letter P (such as, Win32_PageFile)


Discussion is closed.

Feedback usabilla icon