SWbemServices.SubclassesOf method
The SubclassesOf method of the SWbemServices object returns an SWbemObjectSet object. This object is a collection of subclasses of a specified class. Items in the returned collection can be obtained using standard collection methods. For more information, see Accessing a Collection.
This method only works for class objects.
The method is called in the semisynchronous mode. For more information, see Calling a Method.
For an explanation of this syntax, see Document Conventions for the Scripting API.
Syntax
objWbemObjectSet = .SubclassesOf( _
[ ByVal strSuperclass ], _
[ ByVal iFlags ], _
[ ByVal objWbemNamedValueSet ] _
)
Parameters
-
strSuperclass [optional]
-
Specifies a parent class name. Only subclasses of this class return in the enumerator. If you leave this parameter blank, and if iFlags is wbemQueryFlagShallow, only the top-level classes are returned (that is, classes that have no parent class). If this parameter is blank and iFlags is wbemQueryFlagDeep all classes within the namespace are returned.
-
iFlags [optional]
-
Determines how detailed the call enumerates. The default values for this parameter are wbemFlagReturnImmediately and wbemQueryFlagDeep. This parameter can accept the following values.
-
wbemQueryFlagShallow (1 (0x1))
-
Forces the enumeration to include only immediate subclasses of the specified parent class.
-
wbemQueryFlagDeep (0 (0x0))
-
Default for this parameter. This value forces recursive enumeration into all subclasses that are derived from the specified parent class. The parent class is not returned in the enumeration.
-
wbemFlagReturnImmediately (16 (0x10))
-
Causes the call to return immediately.
-
wbemFlagReturnWhenComplete (0 (0x0))
-
Causes this call to block until the call has completed. This flag calls the method in the synchronous mode.
-
wbemFlagUseAmendedQualifiers (131072 (0x20000))
-
Causes WMI to return class amendment data with the base class definition. For more information, see Localizing WMI Class Information.
objWbemNamedValueSet [optional]
Typically, this is undefined. Otherwise, this is an SWbemNamedValueSet object whose elements represent the context information that can be used by the provider servicing the request. A provider that supports or requires such information must document the recognized value names, data type of the value, allowed values, and semantics.
Return value
If the method is successful, an SWbemObjectSet object is returned.
Error codes
After the completion of the SubclassesOf method, the Err object may contain one of the error codes in the following list.
Note
A returned collection with zero elements is not an error.
-
wbemErrAccessDenied - 2147749891 (0x80041003)
-
Current user does not have the permission to view one or more of the classes returned by the call.
-
wbemErrFailed - 2147749889 (0x80041001)
-
Unspecified error.
-
wbemErrInvalidClass - 2147749904 (0x80041010)
-
Specified class does not exist.
-
wbemErrInvalidParameter - 2147749896 (0x80041008)
-
Invalid parameter was specified.
-
wbemErrOutOfMemory - 2147749894 (0x80041006)
-
Not enough memory to complete the operation.
Examples
The following PowerShell sample shows how to retrieve the subclasses of a class on a remote system.
$NameSpace = 'root\ccm'
$ComputerName = 'sccm.company.com'
$WbemLocator = New-Object -ComObject "WbemScripting.SWbemLocator"
$WbemServices = $WbemLocator.ConnectServer($ComputerName, $Namespace)
$WbemClasses = $WbemServices.SubclassesOf()
$WbemClasses
Requirements
Requirement | Value |
---|---|
Minimum supported client |
Windows Vista |
Minimum supported server |
Windows Server 2008 |
Header |
|
Type library |
|
DLL |
|
CLSID |
CLSID_SWbemServices |
IID |
IID_ISWbemServices |