This documentation is archived and is not being maintained.

ManagementObject.GetRelated Method ()

.NET Framework 1.1

Gets a collection of objects related to the object (associators).

[Visual Basic]
Overloads Public Function GetRelated() As ManagementObjectCollection
[C#]
public ManagementObjectCollection GetRelated();
[C++]
public: ManagementObjectCollection* GetRelated();
[JScript]
public function GetRelated() : ManagementObjectCollection;

Return Value

A ManagementObjectCollection containing the related objects.

Remarks

The operation is equivalent to an ASSOCIATORS OF query where ResultClass = relatedClass.

Example

[C#] 
ManagementObject o = new ManagementObject("Win32_Service='Alerter'");
foreach(ManagementBaseObject b in o.GetRelated())
    Console.WriteLine("Object related to Alerter service : ", b.Path);
   
[Visual Basic] 
Dim o As New ManagementObject("Win32_Service=""Alerter""")
Dim b As ManagementBaseObject
For Each b In o.GetRelated()
    Console.WriteLine("Object related to Alerter service : ", b.Path)
Next b
   

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

ManagementObject Class | ManagementObject Members | System.Management Namespace | ManagementObject.GetRelated Overload List

Show: