Export (0) Print
Expand All

ManagementObject.Path Property

Gets or sets the object's WMI path.

Namespace: System.Management
Assembly: System.Management (in system.management.dll)

public virtual ManagementPath Path { get; set; }
/** @property */
public ManagementPath get_Path ()

/** @property */
public void set_Path (ManagementPath value)

public function get Path () : ManagementPath

public function set Path (value : ManagementPath)

Not applicable.

Property Value

A ManagementPath representing the object's path.

Changing the property after the management object has been bound to a WMI object in a particular namespace results in releasing the original WMI object. This causes the management object to be rebound to the new object specified by the new path properties and scope values.

The rebinding is performed in a "lazy" manner, that is, only when a requested value requires the management object to be bound to the WMI object. Changes can be made to more than just the property before attempting to rebind (for example, modifying the scope and path properties simultaneously).

.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.

The following example initializes a new instance of the ManagementObject class with the default namespace, and then changes the WMI path of the ManagementObject.

using System;
using System.Management;
public class Sample 
{
    public static void Main() 
    {
        ManagementObject o = new ManagementObject(); 

        // Specify the WMI path to which 
        // this object should be bound to
        o.Path = new ManagementPath(
            "Win32_Process.Name='calc.exe'");
    }
}

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft