ManagementPath 클래스

정의

WMI 개체에 대한 경로를 구문 분석 및 빌드하기 위해 래퍼를 제공합니다.

public ref class ManagementPath : ICloneable
public class ManagementPath : ICloneable
[System.ComponentModel.TypeConverter(typeof(System.Management.ManagementPathConverter))]
public class ManagementPath : ICloneable
type ManagementPath = class
    interface ICloneable
[<System.ComponentModel.TypeConverter(typeof(System.Management.ManagementPathConverter))>]
type ManagementPath = class
    interface ICloneable
Public Class ManagementPath
Implements ICloneable
상속
ManagementPath
특성
구현

예제

다음 예제에서는 클래스가 ManagementPath WMI 개체에 대한 경로를 구문 분석하는 방법을 보여 줍니다. 예제에서 구문 분석되는 경로는 클래스의 instance 대한 경로입니다.

using System;
using System.Management;

public class Sample
{
    public static void Main()
    {

        // Get the WMI class path
        ManagementPath p =
            new ManagementPath(
            "\\\\ComputerName\\root" +
            "\\cimv2:Win32_LogicalDisk.DeviceID=\"C:\"");

        Console.WriteLine("IsClass: " +
            p.IsClass);
        // Should be False (because it is an instance)

        Console.WriteLine("IsInstance: " +
            p.IsInstance);
        // Should be True

        Console.WriteLine("ClassName: " +
            p.ClassName);
        // Should be "Win32_LogicalDisk"

        Console.WriteLine("NamespacePath: " +
            p.NamespacePath);
        // Should be "ComputerName\cimv2"

        Console.WriteLine("Server: " +
            p.Server);
        // Should be "ComputerName"

        Console.WriteLine("Path: " +
            p.Path);
        // Should be "ComputerName\root\cimv2:
        // Win32_LogicalDisk.DeviceId="C:""

        Console.WriteLine("RelativePath: " +
            p.RelativePath);
        // Should be "Win32_LogicalDisk.DeviceID="C:""
    }
}
Imports System.Management


Public Class Sample
    Public Overloads Shared Function _
        Main(ByVal args() As String) As Integer

        ' Get the WMI class path
        Dim p As ManagementPath = _
            New ManagementPath( _
            "\\ComputerName\root" & _
            "\cimv2:Win32_LogicalDisk.DeviceID=""C:""")

        Console.WriteLine("IsClass: " & _
            p.IsClass)
        ' Should be False (because it is an instance)

        Console.WriteLine("IsInstance: " & _
            p.IsInstance)
        ' Should be True

        Console.WriteLine("ClassName: " & _
            p.ClassName)
        ' Should be "Win32_LogicalDisk"

        Console.WriteLine("NamespacePath: " & _
            p.NamespacePath)
        ' Should be "ComputerName\cimv2"

        Console.WriteLine("Server: " & _
            p.Server)
        ' Should be "ComputerName"

        Console.WriteLine("Path: " & _
            p.Path)
        ' Should be "ComputerName\root\cimv2:
        ' Win32_LogicalDisk.DeviceId="C:""

        Console.WriteLine("RelativePath: " & _
            p.RelativePath)
        ' Should be "Win32_LogicalDisk.DeviceID="C:""

    End Function
End Class

생성자

ManagementPath()

비어 있는 ManagementPath 클래스의 새 인스턴스를 초기화합니다. 이는 매개 변수가 없는 생성자입니다.

ManagementPath(String)

지정된 경로에 대한 ManagementPath 클래스의 새 인스턴스를 초기화합니다.

속성

ClassName

경로의 클래스 부분을 가져오거나 설정합니다.

DefaultPath

범위가 지정되지 않을 경우 사용하는 기본 범위 경로를 가져오거나 설정합니다. 기본 scope \\.\root\cimv2이며 이 속성을 설정하여 변경할 수 있습니다.

IsClass

이것이 클래스 경로인지 여부를 나타내는 값을 가져오거나 설정합니다.

IsInstance

이것이 인스턴스 경로인지 여부를 나타내는 값을 가져오거나 설정합니다.

IsSingleton

이것이 singleton 인스턴스 경로인지 여부를 나타내는 값을 가져오거나 설정합니다.

NamespacePath

경로의 네임스페이스 부분을 가져오거나 설정합니다. 여기에 서버 이름은 포함되지 않습니다. 서버 이름은 별도로 검색될 수 있습니다.

Path

전체 개체 경로의 문자열 표현을 가져오거나 설정합니다.

RelativePath

상대 경로, 즉 클래스 이름과 키만 가져오거나 설정합니다.

Server

경로의 서버 부분을 가져오거나 설정합니다.

메서드

Clone()

ManagementPath의 복사본을 반환합니다.

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
SetAsClass()

이 경로를 새 클래스 경로로 설정합니다. 즉, 경로에는 키 값이 아니라 클래스 이름이 있어야 합니다.

SetAsSingleton()

경로를 새 singleton 개체 경로로 설정합니다. 즉, 해당 경로는 인스턴스에 대한 경로이지만 여기에 키 값은 없습니다.

ToString()

전체 개체 경로를 문자열 표현으로 반환합니다.

명시적 인터페이스 구현

ICloneable.Clone()

현재 인스턴스의 복사본인 새 개체를 만듭니다.

적용 대상