O'Reilly logo

Windows PowerShell™ 3.0 Step by Step by Ed Wilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using WMI to work with static methods

When working with WMI and Windows PowerShell, it is common to think about using the Get-WmiObject cmdlet. Unfortunately, when using the Get-WmiObject cmdlet with the Win32_SecurityDescriptorHelper class, nothing happens. When you attempt to pipeline the results to Get-Member, an error is produced. The two commands appear here (note that gwmi is an alias for Get-WmiObject, and gm is an alias for Get-Member):

PS C:\> gwmi win32_SecurityDescriptorHelper
PS C:\> gwmi win32_SecurityDescriptorHelper | gm
gm : No object has been specified to the Get-Member cmdlet.
At line:1 char:39
+ gwmi win32_SecurityDescriptorHelper | gm
+                                       ~~
    + CategoryInfo          : CloseError: (:) [Get-Member], InvalidOperationException + FullyQualifiedErrorId ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required