ManagementClass.Path Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the path of the WMI class to which the ManagementClass object is bound.
public:
virtual property System::Management::ManagementPath ^ Path { System::Management::ManagementPath ^ get(); void set(System::Management::ManagementPath ^ value); };
public override System.Management.ManagementPath Path { get; set; }
member this.Path : System.Management.ManagementPath with get, set
Public Overrides Property Path As ManagementPath
Property Value
The path of the object's class.
Examples
The following example shows how to initialize a ManagementClass variable with a ManagementClass constructor and then get all the methods in the WMI class passed into the constructor.
using System;
using System.Management;
public class Example
{
public static void Main()
{
ManagementClass c = new ManagementClass();
c.Path.ClassName = "Win32_Process";
foreach (MethodData m in c.Methods)
Console.WriteLine(
"The class contains this method: {0}", m.Name);
return;
}
}
Imports System.Management
Public Class Sample
Public Shared Function Main(ByVal args() _
As String) As Integer
Dim c As New ManagementClass
c.Path.ClassName = "Win32_Process"
Dim m As MethodData
For Each m In c.Methods
Console.WriteLine( _
"The class contains the method : {0}", m.Name)
Next m
Return 0
End Function
End Class
Remarks
When the property is set to a new value, the ManagementClass will be disconnected from any previously-bound WMI class. Reconnect to the new WMI class path.
.NET Framework Security
Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.