Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

ManagementPath Class

Provides a wrapper for parsing and building paths to WMI objects.

For a list of all members of this type, see ManagementPath Members.

System.Object
   System.Management.ManagementPath

[Visual Basic]
Public Class ManagementPath
   Implements ICloneable
[C#]
public class ManagementPath : ICloneable
[C++]
public __gc class ManagementPath : public ICloneable
[JScript]
public class ManagementPath implements ICloneable

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Example

[C#] 
using System; 
using System.Management;
 
// This sample displays all properties in a ManagementPath object. 

class Sample_ManagementPath 
{ 
    public static int Main(string[] args) { 
        ManagementPath path = new ManagementPath( "\\\\MyServer\\MyNamespace:Win32_logicaldisk='c:'");
      
        // Results of full path parsing 
        Console.WriteLine("Path: " + path.Path);
        Console.WriteLine("RelativePath: " + path.RelativePath);
        Console.WriteLine("Server: " + path.Server); 
        Console.WriteLine("NamespacePath: " + path.NamespacePath); 
        Console.WriteLine("ClassName: " + path.ClassName);
        Console.WriteLine("IsClass: " + path.IsClass); 
        Console.WriteLine("IsInstance: " + path.IsInstance); 
        Console.WriteLine("IsSingleton: " + path.IsSingleton); 
           
        // Change a portion of the full path 
        path.Server = "AnotherServer";
        Console.WriteLine("New Path: " + path.Path); 
        return 0; 
   } 
}
   
[Visual Basic] 
Imports System
Imports System.Management 

'This sample displays all properties in a ManagementPath object. 
Class Sample_ManagementPath Overloads
    Public Shared Function Main(args() As String) As Integer
        Dim path As _ New
        ManagementPath("\\MyServer\MyNamespace:Win32_LogicalDisk='c:'") 

        ' Results of full path parsing
        Console.WriteLine("Path: " & path.Path) 
        Console.WriteLine("RelativePath: " & path.RelativePath)
        Console.WriteLine("Server: " & path.Server)
        Console.WriteLine("NamespacePath: " & path.NamespacePath) 
        Console.WriteLine("ClassName: " & path.ClassName) 
        Console.WriteLine("IsClass: " & path.IsClass)
        Console.WriteLine("IsInstance: " & path.IsInstance) 
        Console.WriteLine("IsSingleton: " & path.IsSingleton) 

        ' Change a portion of the full path 
        path.Server= "AnotherServer"
        Console.WriteLine("New Path: " & path.Path)
        Return 0
    End Function
End Class
   

[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

Namespace: System.Management

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

Assembly: System.Management (in System.Management.dll)

See Also

ManagementPath Members | System.Management Namespace

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.