Export (0) Print
Expand All

ManagementObject.GetRelated Method

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

Overload List

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;

Gets a collection of objects related to the object (associators) asynchronously. This call returns immediately, and a delegate is called when the results are available.

[Visual Basic] Overloads Public Sub GetRelated(ManagementOperationObserver)
[C#] public void GetRelated(ManagementOperationObserver);
[C++] public: void GetRelated(ManagementOperationObserver*);
[JScript] public function GetRelated(ManagementOperationObserver);

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

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

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

[Visual Basic] Overloads Public Sub GetRelated(ManagementOperationObserver, String)
[C#] public void GetRelated(ManagementOperationObserver, string);
[C++] public: void GetRelated(ManagementOperationObserver*, String*);
[JScript] public function GetRelated(ManagementOperationObserver, String);

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

[Visual Basic] Overloads Public Function GetRelated(String, String, String, String, String, String, Boolean, EnumerationOptions) As ManagementObjectCollection
[C#] public ManagementObjectCollection GetRelated(string, string, string, string, string, string, bool, EnumerationOptions);
[C++] public: ManagementObjectCollection* GetRelated(String*, String*, String*, String*, String*, String*, bool, EnumerationOptions*);
[JScript] public function GetRelated(String, String, String, String, String, String, Boolean, EnumerationOptions) : ManagementObjectCollection;

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

[Visual Basic] Overloads Public Sub GetRelated(ManagementOperationObserver, String, String, String, String, String, String, Boolean, EnumerationOptions)
[C#] public void GetRelated(ManagementOperationObserver, string, string, string, string, string, string, bool, EnumerationOptions);
[C++] public: void GetRelated(ManagementOperationObserver*, String*, String*, String*, String*, String*, String*, bool, EnumerationOptions*);
[JScript] public function GetRelated(ManagementOperationObserver, String, String, String, String, String, String, Boolean, EnumerationOptions);

Example

[Visual Basic, C#] Note   This example shows how to use one of the overloaded versions of GetRelated. For other examples that might be available, see the individual overload topics.
[C#] 
ManagementObject o = new ManagementObject("Win32_Service='Alerter'");
foreach (ManagementBaseObject b in o.GetRelated("Win32_Service")
    Console.WriteLine("Service related to the Alerter service {0} is {1}", b["Name"], b["State"]);
   
[Visual Basic] 
Dim o As New ManagementObject("Win32_Service=""Alerter""");
Dim b As ManagementBaseObject
For Each b in o.GetRelated("Win32_Service")
    Console.WriteLine("Service related to the Alerter service {0} is {1}", b("Name"), b("State"))
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.

See Also

ManagementObject Class | ManagementObject Members | System.Management Namespace

Show:
© 2014 Microsoft