Click to Rate and Give Feedback
MSDN
MSDN Library
WMI Reference
SWbemServices
 SWbemServices.AssociatorsOf Method
SWbemServices.AssociatorsOf Method

The AssociatorsOf method of the SWbemServices object returns a collection of objects (classes or instances) called endpoints that are associated with a specified object. This method performs the same function that the ASSOCIATORS OF WQL query performs.

This method is called in the semisynchronous mode by default. For more information, see Calling a Method.

The following syntax is language-neutral. For an explanation of this syntax, see Document Conventions for the Scripting API.

Syntax

objWbemObjectSet = AssociatorsOf(
  strObjectPath,
  [ strAssocClass = "" ],
  [ strResultClass = "" ],
  [ strResultRole = "" ],
  [ strRole = "" ],
  [ bClassesOnly = FALSE ],
  [ bSchemaOnly = FALSE ],
  [ strRequiredAssocQualifier = "" ],
  [ strRequiredQualifier = "" ],
  [ iFlags = wbemFlagReturnImmediately ],
  [ objwbemNamedValueSet = null ]
)

Parameters

strObjectPath

Required. String that contains the object path of the source class or instance. For more information, see Describing the Location of a WMI Object.

strAssocClass [optional]

String that contains an association class. If specified, this parameter indicates that the returned endpoints must be associated with the source through the specified association class or a class that is derived from this association class.

strResultClass [optional]

String that contains a class name. If specified, this optional parameter indicates that the returned endpoints must belong to or be derived from the class specified in this parameter.

strResultRole [optional]

String that contains a property name. If specified, this parameter indicates that the returned endpoints must play a particular role in their association with the source object. The role is defined by the name of a specified property (which must be a reference property) of an association.

strRole [optional]

String that contains a property name. If specified, this parameter indicates that the returned endpoints must participate in an association with the source object in which the source object plays a particular role. The role is defined by the name of a specified property (which must be a reference property) of an association.

bClassesOnly [optional]

Boolean value that indicates whether a list of class names should be returned rather than actual instances of the classes. These are the classes to which the endpoint instances belong. The default value for this parameter is FALSE.

bSchemaOnly [optional]

Boolean value that indicates whether the query applies to the schema rather than the data. The default value for this parameter is FALSE. It can only be set to TRUE if the strObjectPath parameter specifies the object path of a class. When set to TRUE, the set of returned endpoints represent classes that are suitably associated with the source class in schema.

strRequiredAssocQualifier [optional]

String that contains a qualifier name. If specified, this parameter indicates that the returned endpoints must be associated with the source object through an association class that includes the specified qualifier.

strRequiredQualifier [optional]

String that contains a qualifier name. If specified, this parameter indicates that the returned endpoints must include the specified qualifier.

iFlags [optional]

Integer that specifies additional flags to the operation. The default value for this parameter is wbemFlagReturnImmediately, which calls the method in the semisynchronous mode. This parameter can accept the following values.

Value Meaning

wbemFlagForwardOnly
32
0x20

Causes a forward-only enumerator to be returned. Forward-only enumerators are generally much faster and use less memory than conventional enumerators, but they do not allow calls to SWbemObject.Clone_.

wbemFlagBidirectional
0
0x0

Causes WMI to retain pointers to objects of the enumeration until the client releases the enumerator.

wbemFlagReturnImmediately
16
0x10

Causes the call to return immediately.

wbemFlagReturnWhenComplete
0
0x0

Causes this call to block until the query has completed. This flag calls the method in synchronous mode.

wbemFlagUseAmendedQualifiers
131072
0x20000

Causes WMI to return class amendment data along 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 that is 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.

objWbemObjectSet

If the call is successful, an SWbemObjectSet object is returned.

Return Value

This method does not return a value.

Error Codes

After the completion of the AssociatorsOf method, the Err object may contain one of the error codes in the following table.

Note  A returned collection with zero elements is not an error.

Error (Name/Dec/Hex) Meaning

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.

wbemErrInvalidParameter
2147749896
0x80041008

Invalid parameter was specified.

wbemErrOutOfMemory
2147749894
0x80041006

Not enough memory to complete the operation.

wbemErrNotFound
2147749890
0x80041002

Requested item was not found.

Example Code

For script code examples, see WMI Tasks for Scripts and Applications and the TechNet ScriptCenter Script Repository.

Remarks

For more information about the ASSOCIATORS OF WQL query, source instances, and endpoints, see ASSOCIATORS OF Statement.

Requirements

Client Requires Windows Vista, Windows XP, Windows 2000 Professional, Windows NT Workstation 4.0 SP4 and later, Windows Me, Windows 98, or Windows 95 OSR2 and later.
Server Requires Windows Server 2008, Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0 SP4 and later.
Type Library

Use Wbemdisp.tlb.

DLL

Requires Wbemdisp.dll.

See Also

SWbemObject.Associators_
SWbemObject.AssociatorsAsync_
SWbemServices.AssociatorsOfAsync
SWbemObject.References_
SWbemServices.ReferencesTo


Send comments about this topic to Microsoft

Build date: 6/19/2008

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content      
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker