I am using PowerShell 2.0 and trying to get the possible methods from Win32_ShadowCopy.
Now, when I use Get-WmiObject -list Win32_ShadowCopy | Get-Member I get:
TypeName: System.Management.ManagementClass#ROOT\cimv2\Win32_ShadowCopy
Name MemberType Definition
---- ---------- ----------
Name AliasProperty Name = __Class
Create Method System.Management.ManagementBaseObject Cre...
...
But if I use Get-WmiObject Win32_ShadowCopy | Get-Member i get:
TypeName: System.Management.ManagementObject#root\cimv2\Win32_ShadowCopy
Name MemberType Definition
---- ---------- ----------
Revert Method System.Management.ManagementBaseObject Reve...
Caption Property System.String Caption {get;set;}
...
Now I don’t understand. Why do I get 2 seemingly different classes? I expect the same result with both commands. I can find what -list does in the documentation, but not what the default behavior is without the -list switch. Anyone care to clarify?
This is from get-help about list.
-List []
Specifies whether to retrieve and display the names of the WMI classes
in the WMI repository namespace that is specified in the Namespace para
meter. The Default Namespace registry entry in the HKEY_LOCAL_MACHINE\
SOFTWARE\Microsoft\WBEM\Scripting registry key is not used by this cmdl
et to determine the default namespace. If you specify the List paramete
r but not the Namespace parameter, the root\CIMV2 namespace is used by
default.
for your script
equals:
which means you’re listing classes with name Win32_ShadowCopy.
And the
equals:
which returns the objects of the specified class.