Share via


ManagementClass 생성자

정의

ManagementClass 클래스의 새 인스턴스를 초기화합니다.

오버로드

ManagementClass()

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

ManagementClass(ManagementPath)

ManagementClass 클래스의 새 인스턴스를 초기화합니다. 이 클래스는 Notepad.exe 등의 프로세스를 나타내는 Win32_LogicalDisk와 디스크 드라이브를 나타낼 수 있는 Win32_Process 같은 WMI의 CIM(Common Information Model) 관리 클래스를 나타냅니다.

ManagementClass(String)

지정된 경로로 초기화된 ManagementClass 클래스의 새 인스턴스를 초기화합니다. 이 클래스는 Notepad.exe 등의 프로세스를 나타내는 Win32_LogicalDisk와 디스크 드라이브를 나타낼 수 있는 Win32_Process 같은 WMI의 CIM(Common Information Model) 관리 클래스를 나타냅니다.

ManagementClass(ManagementPath, ObjectGetOptions)

지정된 옵션을 사용하여 지정된 WMI 클래스로 초기화된 ManagementClass 클래스의 새 인스턴스를 초기합니다. 이 클래스는 Notepad.exe 등의 프로세스를 나타내는 Win32_LogicalDisk와 디스크 드라이브를 나타낼 수 있는 Win32_Process 같은 WMI의 CIM(Common Information Model) 관리 클래스를 나타냅니다.

ManagementClass(SerializationInfo, StreamingContext)
사용되지 않음.

ManagementClassSerializationInfo 클래스에 지정된 인스턴스에서 StreamingContext 클래스의 새 인스턴스를 초기화합니다.

ManagementClass(String, ObjectGetOptions)

지정된 옵션을 사용하여 지정된 WMI 클래스로 초기화된 ManagementClass 클래스의 새 인스턴스를 초기합니다. 이 클래스는 Notepad.exe 등의 프로세스를 나타내는 Win32_LogicalDisk와 디스크 드라이브를 나타낼 수 있는 Win32_Process 같은 WMI의 CIM(Common Information Model) 관리 클래스를 나타냅니다.

ManagementClass(ManagementScope, ManagementPath, ObjectGetOptions)

지정된 범위 및 옵션을 사용하여, 지정된 WMI 클래스에 대한 ManagementClass 클래스의 새 인스턴스를 초기화합니다. 이 클래스는 Notepad.exe 등의 프로세스를 나타내는 Win32_LogicalDisk와 디스크 드라이브를 나타낼 수 있는 Win32_Process 같은 WMI의 CIM(Common Information Model) 관리 클래스를 나타냅니다.

ManagementClass(String, String, ObjectGetOptions)

지정된 범위 및 옵션을 사용하여, 지정된 WMI 클래스에 대한 ManagementClass 클래스의 새 인스턴스를 초기화합니다. 이 클래스는 Notepad.exe 등의 프로세스를 나타내는 Win32_LogicalDisk와 디스크 드라이브를 나타낼 수 있는 Win32_Process 같은 WMI의 CIM(Common Information Model) 관리 클래스를 나타냅니다.

설명

.NET Framework 보안

직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분적으로 신뢰할 수 있는 코드에서 라이브러리를 사용 하 여입니다.

ManagementClass()

Source:
ManagementClass.cs
Source:
ManagementClass.cs
Source:
ManagementClass.cs

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

public:
 ManagementClass();
public ManagementClass ();
Public Sub New ()

예제

다음 예제는 매개 변수가 없는 생성자를 사용하여 변수를 ManagementClass 초기화하는 방법의 ManagementClass 예입니다. 이 예제에서는 만든 클래스에 대한 메서드, 속성 및 한정자를 나열합니다.

using System;
using System.Management;

public class Sample
{
    public static void Main()
    {

        // Get the WMI class
        ManagementClass processClass =
            new ManagementClass();
        processClass.Path = new
            ManagementPath("Win32_Process");

        // Get the methods in the class
        MethodDataCollection methods =
            processClass.Methods;

        // display the methods
        Console.WriteLine("Method Names: ");
        foreach (MethodData method in methods)
        {
            Console.WriteLine(method.Name);
        }
        Console.WriteLine();

        // Get the properties in the class
        PropertyDataCollection properties =
            processClass.Properties;

        // display the properties
        Console.WriteLine("Property Names: ");
        foreach (PropertyData property in properties)
        {
            Console.WriteLine(property.Name);
        }
        Console.WriteLine();

        // Get the Qualifiers in the class
        QualifierDataCollection qualifiers =
            processClass.Qualifiers;

        // display the qualifiers
        Console.WriteLine("Qualifier Names: ");
        foreach (QualifierData qualifier in qualifiers)
        {
            Console.WriteLine(qualifier.Name);
        }
    }
}
Imports System.Management


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

        ' Get the WMI class
        Dim processClass As New ManagementClass
        processClass.Path = New _
            ManagementPath("Win32_Process")

        ' Get the methods in the class
        Dim methods As MethodDataCollection
        methods = processClass.Methods

        ' display the methods
        Console.WriteLine("Method Names: ")
        For Each method As MethodData In methods

            Console.WriteLine(method.Name)
        Next
        Console.WriteLine()

        ' Get the properties in the class
        Dim properties As PropertyDataCollection
        properties = processClass.Properties

        ' display the properties
        Console.WriteLine("Property Names: ")
        For Each p As PropertyData In properties

            Console.WriteLine(p.Name)
        Next
        Console.WriteLine()

        ' Get the Qualifiers in the class
        Dim qualifiers As QualifierDataCollection = _
        processClass.Qualifiers()

        ' display the qualifiers
        Console.WriteLine("Qualifier Names: ")
        For Each qualifier As QualifierData In qualifiers

            Console.WriteLine(qualifier.Name)
        Next

    End Function
End Class

설명

.NET Framework 보안

직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분적으로 신뢰할 수 있는 코드에서 라이브러리를 사용 하 여입니다.

적용 대상

ManagementClass(ManagementPath)

Source:
ManagementClass.cs
Source:
ManagementClass.cs
Source:
ManagementClass.cs

ManagementClass 클래스의 새 인스턴스를 초기화합니다. 이 클래스는 Notepad.exe 등의 프로세스를 나타내는 Win32_LogicalDisk와 디스크 드라이브를 나타낼 수 있는 Win32_Process 같은 WMI의 CIM(Common Information Model) 관리 클래스를 나타냅니다.

public:
 ManagementClass(System::Management::ManagementPath ^ path);
public ManagementClass (System.Management.ManagementPath path);
new System.Management.ManagementClass : System.Management.ManagementPath -> System.Management.ManagementClass
Public Sub New (path As ManagementPath)

매개 변수

path
ManagementPath

바인딩할 WMI 클래스를 지정하는 ManagementPath입니다. 매개 변수는 WMI 클래스 경로를 지정해야 합니다. 이 클래스는 WMI의 CIM 관리 클래스를 나타냅니다. CIM 클래스는 하드웨어, 소프트웨어, 프로세스 등의 관리 정보를 나타냅니다. Windows에서 사용할 수 있는 CIM 클래스에 대한 자세한 내용은 CIM 클래스를 참조하세요.

예제

다음 예제는 생성자를 사용하여 변수를 ManagementClass 초기화하는 방법의 예입니다 ManagementClass . 이 예제에서는 만든 클래스에 대한 메서드, 속성 및 한정자를 나열합니다.

using System;
using System.Management;

public class Sample
{
    public static void Main()
    {

        // Get the WMI class
        ManagementClass c = new ManagementClass(
            new ManagementPath("Win32_LogicalDisk"));

        // Get the methods in the class
        MethodDataCollection methods =
            c.Methods;

        // display the methods
        Console.WriteLine("Method Names: ");
        foreach (MethodData method in methods)
        {
            Console.WriteLine(method.Name);
        }
        Console.WriteLine();

        // Get the properties in the class
        PropertyDataCollection properties =
            c.Properties;

        // display the properties
        Console.WriteLine("Property Names: ");
        foreach (PropertyData property in properties)
        {
            Console.WriteLine(property.Name);
        }
        Console.WriteLine();

        // Get the Qualifiers in the class
        QualifierDataCollection qualifiers =
            c.Qualifiers;

        // display the qualifiers
        Console.WriteLine("Qualifier Names: ");
        foreach (QualifierData qualifier in qualifiers)
        {
            Console.WriteLine(qualifier.Name);
        }
    }
}
Imports System.Management


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

        ' Get the WMI class
        Dim c As New ManagementClass( _
            New ManagementPath("Win32_LogicalDisk"))


        ' Get the methods in the class
        Dim methods As MethodDataCollection
        methods = c.Methods

        ' display the methods
        Console.WriteLine("Method Names: ")
        For Each method As MethodData In methods

            Console.WriteLine(method.Name)
        Next
        Console.WriteLine()

        ' Get the properties in the class
        Dim properties As PropertyDataCollection
        properties = c.Properties

        ' display the properties
        Console.WriteLine("Property Names: ")
        For Each p As PropertyData In properties

            Console.WriteLine(p.Name)
        Next
        Console.WriteLine()

        ' Get the Qualifiers in the class
        Dim qualifiers As QualifierDataCollection = _
        c.Qualifiers()

        ' display the qualifiers
        Console.WriteLine("Qualifier Names: ")
        For Each qualifier As QualifierData In qualifiers

            Console.WriteLine(qualifier.Name)
        Next

    End Function
End Class

설명

매개 변수는 path WMI 클래스 경로를 지정해야 합니다.

.NET Framework 보안

직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분적으로 신뢰할 수 있는 코드에서 라이브러리를 사용 하 여입니다.

적용 대상

ManagementClass(String)

Source:
ManagementClass.cs
Source:
ManagementClass.cs
Source:
ManagementClass.cs

지정된 경로로 초기화된 ManagementClass 클래스의 새 인스턴스를 초기화합니다. 이 클래스는 Notepad.exe 등의 프로세스를 나타내는 Win32_LogicalDisk와 디스크 드라이브를 나타낼 수 있는 Win32_Process 같은 WMI의 CIM(Common Information Model) 관리 클래스를 나타냅니다.

public:
 ManagementClass(System::String ^ path);
public ManagementClass (string path);
new System.Management.ManagementClass : string -> System.Management.ManagementClass
Public Sub New (path As String)

매개 변수

path
String

WMI 클래스의 경로입니다. 이 클래스는 WMI의 CIM 관리 클래스를 나타냅니다. CIM 클래스는 하드웨어, 소프트웨어, 프로세스 등의 관리 정보를 나타냅니다. Windows에서 사용할 수 있는 CIM 클래스에 대한 자세한 내용은 CIM 클래스를 참조하세요.

예제

다음 예제에서는 생성자를 사용하여 변수 ManagementClassManagementClass 초기화하는 방법을 보여줍니다. 이 예제에서는 만든 클래스에 대한 메서드, 속성 및 한정자를 나열합니다.

using System;
using System.Management;

public class Sample
{
    public static void Main()
    {

        // Get the WMI class
        ManagementClass c =
            new ManagementClass("Win32_LogicalDisk");

        // Get the methods in the class
        MethodDataCollection methods =
            c.Methods;

        // display the methods
        Console.WriteLine("Method Names: ");
        foreach (MethodData method in methods)
        {
            Console.WriteLine(method.Name);
        }
        Console.WriteLine();

        // Get the properties in the class
        PropertyDataCollection properties =
            c.Properties;

        // display the properties
        Console.WriteLine("Property Names: ");
        foreach (PropertyData property in properties)
        {
            Console.WriteLine(property.Name);
        }
        Console.WriteLine();

        // Get the Qualifiers in the class
        QualifierDataCollection qualifiers =
            c.Qualifiers;

        // display the qualifiers
        Console.WriteLine("Qualifier Names: ");
        foreach (QualifierData qualifier in qualifiers)
        {
            Console.WriteLine(qualifier.Name);
        }
    }
}
Imports System.Management


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

        ' Get the WMI class
        Dim c As New ManagementClass("Win32_LogicalDisk")

        ' Get the methods in the class
        Dim methods As MethodDataCollection
        methods = c.Methods

        ' display the methods
        Console.WriteLine("Method Names: ")
        For Each method As MethodData In methods

            Console.WriteLine(method.Name)
        Next
        Console.WriteLine()

        ' Get the properties in the class
        Dim properties As PropertyDataCollection
        properties = c.Properties

        ' display the properties
        Console.WriteLine("Property Names: ")
        For Each p As PropertyData In properties

            Console.WriteLine(p.Name)
        Next
        Console.WriteLine()

        ' Get the Qualifiers in the class
        Dim qualifiers As QualifierDataCollection = _
        c.Qualifiers()

        ' display the qualifiers
        Console.WriteLine("Qualifier Names: ")
        For Each qualifier As QualifierData In qualifiers

            Console.WriteLine(qualifier.Name)
        Next

    End Function
End Class

설명

.NET Framework 보안

직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분적으로 신뢰할 수 있는 코드에서 라이브러리를 사용 하 여입니다.

적용 대상

ManagementClass(ManagementPath, ObjectGetOptions)

Source:
ManagementClass.cs
Source:
ManagementClass.cs
Source:
ManagementClass.cs

지정된 옵션을 사용하여 지정된 WMI 클래스로 초기화된 ManagementClass 클래스의 새 인스턴스를 초기합니다. 이 클래스는 Notepad.exe 등의 프로세스를 나타내는 Win32_LogicalDisk와 디스크 드라이브를 나타낼 수 있는 Win32_Process 같은 WMI의 CIM(Common Information Model) 관리 클래스를 나타냅니다.

public:
 ManagementClass(System::Management::ManagementPath ^ path, System::Management::ObjectGetOptions ^ options);
public ManagementClass (System.Management.ManagementPath path, System.Management.ObjectGetOptions options);
new System.Management.ManagementClass : System.Management.ManagementPath * System.Management.ObjectGetOptions -> System.Management.ManagementClass
Public Sub New (path As ManagementPath, options As ObjectGetOptions)

매개 변수

path
ManagementPath

WMI 클래스 경로를 나타내는 ManagementPath 인스턴스입니다. 이 클래스는 WMI의 CIM 관리 클래스를 나타냅니다. CIM 클래스는 하드웨어, 소프트웨어, 프로세스 등의 관리 정보를 나타냅니다. Windows에서 사용할 수 있는 CIM 클래스에 대한 자세한 내용은 CIM 클래스를 참조하세요.

options
ObjectGetOptions

이 클래스를 검색할 때 사용할 옵션을 나타내는 ObjectGetOptions입니다.

예제

다음 예제는 생성자를 사용하여 변수를 ManagementClass 초기화하는 방법의 예입니다 ManagementClass . 이 예제에서는 만든 클래스에 대한 메서드, 속성 및 한정자(수정된 한정자 포함)를 나열합니다.

using System;
using System.Management;

public class Sample
{
    public static void Main()
    {

        // Get the WMI class
        ManagementPath p =
            new ManagementPath("Win32_Process");
        // Options specify that amended qualifiers
        // are to be retrieved along with the class
        ObjectGetOptions o = new ObjectGetOptions(
            null, System.TimeSpan.MaxValue, true);
        ManagementClass c = new ManagementClass(p,o);

        // Get the methods in the class
        MethodDataCollection methods =
            c.Methods;

        // display the methods
        Console.WriteLine("Method Names: ");
        foreach (MethodData method in methods)
        {
            Console.WriteLine(method.Name);
        }
        Console.WriteLine();

        // Get the properties in the class
        PropertyDataCollection properties =
            c.Properties;

        // display the properties
        Console.WriteLine("Property Names: ");
        foreach (PropertyData property in properties)
        {
            Console.WriteLine(property.Name);
        }
        Console.WriteLine();

        // Get the Qualifiers in the class
        QualifierDataCollection qualifiers =
            c.Qualifiers;

        // display the qualifiers
        Console.WriteLine("Qualifier Names: ");
        foreach (QualifierData qualifier in qualifiers)
        {
            Console.WriteLine(qualifier.Name);
        }
    }
}
Imports System.Management


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

        ' Get the WMI class
        Dim p As New ManagementPath("Win32_Process")
        ' Options specify that amended qualifiers
        ' are to be retrieved along with the class
        Dim o As New ObjectGetOptions( _
            Nothing, System.TimeSpan.MaxValue, True)
        Dim c As New ManagementClass(p, o)

        ' Get the methods in the class
        Dim methods As MethodDataCollection
        methods = c.Methods

        ' display the methods
        Console.WriteLine("Method Names: ")
        For Each method As MethodData In methods

            Console.WriteLine(method.Name)
        Next
        Console.WriteLine()

        ' Get the properties in the class
        Dim properties As PropertyDataCollection
        properties = c.Properties

        ' display the properties
        Console.WriteLine("Property Names: ")
        For Each pdata As PropertyData In properties

            Console.WriteLine(pdata.Name)
        Next
        Console.WriteLine()

        ' Get the Qualifiers in the class
        Dim qualifiers As QualifierDataCollection = _
        c.Qualifiers()

        ' display the qualifiers
        Console.WriteLine("Qualifier Names: ")
        For Each qualifier As QualifierData In qualifiers

            Console.WriteLine(qualifier.Name)
        Next

    End Function
End Class

설명

.NET Framework 보안

직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분적으로 신뢰할 수 있는 코드에서 라이브러리를 사용 하 여입니다.

적용 대상

ManagementClass(SerializationInfo, StreamingContext)

Source:
ManagementClass.cs
Source:
ManagementClass.cs
Source:
ManagementClass.cs

주의

This API supports obsolete formatter-based serialization. It should not be called or extended by application code.

ManagementClassSerializationInfo 클래스에 지정된 인스턴스에서 StreamingContext 클래스의 새 인스턴스를 초기화합니다.

protected:
 ManagementClass(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected ManagementClass (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected ManagementClass (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.Management.ManagementClass : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Management.ManagementClass
[<System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Management.ManagementClass : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Management.ManagementClass
Protected Sub New (info As SerializationInfo, context As StreamingContext)

매개 변수

info
SerializationInfo

SerializationInfo를 serialize하는 데 필요한 정보가 들어 있는 ManagementClass 클래스의 인스턴스입니다.

context
StreamingContext

StreamingContext와 관련된 serialize된 스트림의 소스가 들어 있는 ManagementClass 클래스의 인스턴스입니다.

특성

설명

.NET Framework 보안

직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분적으로 신뢰할 수 있는 코드에서 라이브러리를 사용 하 여입니다.

적용 대상

ManagementClass(String, ObjectGetOptions)

Source:
ManagementClass.cs
Source:
ManagementClass.cs
Source:
ManagementClass.cs

지정된 옵션을 사용하여 지정된 WMI 클래스로 초기화된 ManagementClass 클래스의 새 인스턴스를 초기합니다. 이 클래스는 Notepad.exe 등의 프로세스를 나타내는 Win32_LogicalDisk와 디스크 드라이브를 나타낼 수 있는 Win32_Process 같은 WMI의 CIM(Common Information Model) 관리 클래스를 나타냅니다.

public:
 ManagementClass(System::String ^ path, System::Management::ObjectGetOptions ^ options);
public ManagementClass (string path, System.Management.ObjectGetOptions options);
new System.Management.ManagementClass : string * System.Management.ObjectGetOptions -> System.Management.ManagementClass
Public Sub New (path As String, options As ObjectGetOptions)

매개 변수

path
String

WMI 클래스의 경로입니다. 이 클래스는 WMI의 CIM 관리 클래스를 나타냅니다. CIM 클래스는 하드웨어, 소프트웨어, 프로세스 등의 관리 정보를 나타냅니다. Windows에서 사용할 수 있는 CIM 클래스에 대한 자세한 내용은 CIM 클래스를 참조하세요.

options
ObjectGetOptions

WMI 클래스를 검색할 때 사용할 옵션을 나타내는 ObjectGetOptions입니다.

예제

다음 예제에서는 생성자를 사용하여 변수 ManagementClassManagementClass 초기화하는 방법을 보여줍니다. 이 예제에서는 만든 클래스에 대한 메서드, 속성 및 한정자(수정된 한정자 포함)를 나열합니다.

using System;
using System.Management;

public class Sample
{
    public static void Main()
    {

        // Get the WMI class
        //Options specify that amended qualifiers
        // should be retrieved along with the class
        ObjectGetOptions o = new ObjectGetOptions(
            null, System.TimeSpan.MaxValue, true);
        ManagementClass c =
            new ManagementClass("Win32_ComputerSystem",o);

        // Get the methods in the class
        MethodDataCollection methods =
            c.Methods;

        // display the methods
        Console.WriteLine("Method Names: ");
        foreach (MethodData method in methods)
        {
            Console.WriteLine(method.Name);
        }
        Console.WriteLine();

        // Get the properties in the class
        PropertyDataCollection properties =
            c.Properties;

        // display the properties
        Console.WriteLine("Property Names: ");
        foreach (PropertyData property in properties)
        {
            Console.WriteLine(property.Name);
        }
        Console.WriteLine();

        // Get the Qualifiers in the class
        QualifierDataCollection qualifiers =
            c.Qualifiers;

        // display the qualifiers
        Console.WriteLine("Qualifier Names: ");
        foreach (QualifierData qualifier in qualifiers)
        {
            Console.WriteLine(qualifier.Name);
        }
    }
}
Imports System.Management

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

        ' Get the WMI class
        ' Options specify that amended qualifiers
        ' should be retrieved along with the class
        Dim o As New ObjectGetOptions( _
            Nothing, System.TimeSpan.MaxValue, True)
        Dim c As New ManagementClass("Win32_ComputerSystem", o)

        ' Get the methods in the class
        Dim methods As MethodDataCollection
        methods = c.Methods

        ' display the methods
        Console.WriteLine("Method Names: ")
        For Each method As MethodData In methods

            Console.WriteLine(method.Name)
        Next
        Console.WriteLine()

        ' Get the properties in the class
        Dim properties As PropertyDataCollection
        properties = c.Properties

        ' display the properties
        Console.WriteLine("Property Names: ")
        For Each p As PropertyData In properties

            Console.WriteLine(p.Name)
        Next
        Console.WriteLine()

        ' Get the Qualifiers in the class
        Dim qualifiers As QualifierDataCollection = _
        c.Qualifiers()

        ' display the qualifiers
        Console.WriteLine("Qualifier Names: ")
        For Each qualifier As QualifierData In qualifiers

            Console.WriteLine(qualifier.Name)
        Next

    End Function
End Class

설명

.NET Framework 보안

직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분적으로 신뢰할 수 있는 코드에서 라이브러리를 사용 하 여입니다.

적용 대상

ManagementClass(ManagementScope, ManagementPath, ObjectGetOptions)

Source:
ManagementClass.cs
Source:
ManagementClass.cs
Source:
ManagementClass.cs

지정된 범위 및 옵션을 사용하여, 지정된 WMI 클래스에 대한 ManagementClass 클래스의 새 인스턴스를 초기화합니다. 이 클래스는 Notepad.exe 등의 프로세스를 나타내는 Win32_LogicalDisk와 디스크 드라이브를 나타낼 수 있는 Win32_Process 같은 WMI의 CIM(Common Information Model) 관리 클래스를 나타냅니다.

public:
 ManagementClass(System::Management::ManagementScope ^ scope, System::Management::ManagementPath ^ path, System::Management::ObjectGetOptions ^ options);
public ManagementClass (System.Management.ManagementScope scope, System.Management.ManagementPath path, System.Management.ObjectGetOptions options);
new System.Management.ManagementClass : System.Management.ManagementScope * System.Management.ManagementPath * System.Management.ObjectGetOptions -> System.Management.ManagementClass
Public Sub New (scope As ManagementScope, path As ManagementPath, options As ObjectGetOptions)

매개 변수

scope
ManagementScope

WMI 클래스가 속한 범위(서버 및 네임스페이스)를 지정하는 ManagementScope입니다.

path
ManagementPath

지정된 범위에 속한 WMI 클래스의 경로를 나타내는 ManagementPath입니다. 이 클래스는 WMI의 CIM 관리 클래스를 나타냅니다. CIM 클래스는 하드웨어, 소프트웨어, 프로세스 등의 관리 정보를 나타냅니다. Windows에서 사용할 수 있는 CIM 클래스에 대한 자세한 내용은 CIM 클래스를 참조하세요.

options
ObjectGetOptions

WMI 클래스를 검색할 때 사용할 옵션을 지정하는 ObjectGetOptions입니다.

예제

다음 예제는 생성자를 사용하여 변수를 ManagementClass 초기화하는 방법의 예입니다 ManagementClass . 이 예제에서는 만든 클래스에 대한 메서드, 속성 및 한정자(수정된 한정자 포함)를 나열합니다. 예제가 컴퓨터에서 올바르게 실행되도록 코드의 scope(네임스페이스)를 변경해야 합니다.

using System;
using System.Management;

public class Sample
{
    public static void Main()
    {

        // Get the WMI class
        ManagementScope s =
            new ManagementScope("\\\\MyBox\\root\\cimv2");
        ManagementPath p = new ManagementPath("Win32_Environment");
        ObjectGetOptions o = new ObjectGetOptions(
            null, System.TimeSpan.MaxValue, true);
        ManagementClass c = new ManagementClass(s, p, o);

        // Get the methods in the class
        MethodDataCollection methods =
            c.Methods;

        // display the methods
        Console.WriteLine("Method Names: ");
        foreach (MethodData method in methods)
        {
            Console.WriteLine(method.Name);
        }
        Console.WriteLine();

        // Get the properties in the class
        PropertyDataCollection properties =
            c.Properties;

        // display the properties
        Console.WriteLine("Property Names: ");
        foreach (PropertyData property in properties)
        {
            Console.WriteLine(property.Name);
        }
        Console.WriteLine();

        // Get the Qualifiers in the class
        QualifierDataCollection qualifiers =
            c.Qualifiers;

        // display the qualifiers
        Console.WriteLine("Qualifier Names: ");
        foreach (QualifierData qualifier in qualifiers)
        {
            Console.WriteLine(qualifier.Name);
        }
    }
}
Imports System.Management

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

        ' Get the WMI class
        Dim s As New ManagementScope("\\MyBox\root\cimv2")
        Dim p As New ManagementPath("Win32_Environment")
        Dim o As New ObjectGetOptions( _
            Nothing, System.TimeSpan.MaxValue, True)
        Dim c As New ManagementClass(s, p, o)

        ' Get the methods in the class
        Dim methods As MethodDataCollection
        methods = c.Methods

        ' display the methods
        Console.WriteLine("Method Names: ")
        For Each method As MethodData In methods

            Console.WriteLine(method.Name)
        Next
        Console.WriteLine()

        ' Get the properties in the class
        Dim properties As PropertyDataCollection
        properties = c.Properties

        ' display the properties
        Console.WriteLine("Property Names: ")
        Dim data As PropertyData
        For Each data In properties

            Console.WriteLine(data.Name)
        Next
        Console.WriteLine()

        ' Get the Qualifiers in the class
        Dim qualifiers As QualifierDataCollection = _
        c.Qualifiers()

        ' display the qualifiers
        Console.WriteLine("Qualifier Names: ")
        For Each qualifier As QualifierData In qualifiers

            Console.WriteLine(qualifier.Name)
        Next

    End Function
End Class

설명

경로는 전체 경로(서버 및 네임스페이스 포함)로 지정할 수 있습니다. 그러나 scope 지정되면 전체 경로의 첫 번째 부분을 재정의합니다.

.NET Framework 보안

직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분적으로 신뢰할 수 있는 코드에서 라이브러리를 사용 하 여입니다.

적용 대상

ManagementClass(String, String, ObjectGetOptions)

Source:
ManagementClass.cs
Source:
ManagementClass.cs
Source:
ManagementClass.cs

지정된 범위 및 옵션을 사용하여, 지정된 WMI 클래스에 대한 ManagementClass 클래스의 새 인스턴스를 초기화합니다. 이 클래스는 Notepad.exe 등의 프로세스를 나타내는 Win32_LogicalDisk와 디스크 드라이브를 나타낼 수 있는 Win32_Process 같은 WMI의 CIM(Common Information Model) 관리 클래스를 나타냅니다.

public:
 ManagementClass(System::String ^ scope, System::String ^ path, System::Management::ObjectGetOptions ^ options);
public ManagementClass (string scope, string path, System.Management.ObjectGetOptions options);
new System.Management.ManagementClass : string * string * System.Management.ObjectGetOptions -> System.Management.ManagementClass
Public Sub New (scope As String, path As String, options As ObjectGetOptions)

매개 변수

scope
String

WMI 클래스가 속한 범위입니다.

path
String

지정된 범위 내에 속해 있는 WMI 클래스의 경로입니다. 이 클래스는 WMI의 CIM 관리 클래스를 나타냅니다. CIM 클래스는 하드웨어, 소프트웨어, 프로세스 등의 관리 정보를 나타냅니다. Windows에서 사용할 수 있는 CIM 클래스에 대한 자세한 내용은 CIM 클래스를 참조하세요.

options
ObjectGetOptions

WMI 클래스를 검색할 때 사용할 옵션을 지정하는 ObjectGetOptions입니다.

예제

다음 예제에서는 생성자를 사용하여 변수 ManagementClassManagementClass 초기화하는 방법을 보여줍니다. 이 예제에서는 만든 클래스에 대한 메서드, 속성 및 한정자(수정된 한정자 포함)를 나열합니다. 예제가 컴퓨터에서 올바르게 실행되도록 코드의 scope(네임스페이스)를 변경해야 합니다.

using System;
using System.Management;

public class Sample
{
    public static void Main()
    {

        // Get the WMI class
        //Options specify that amended qualifiers
        // should be retrieved along with the class
        ManagementClass c =
            new ManagementClass("\\\\MyBox\\root\\cimv2",
            "Win32_Environment",
            new ObjectGetOptions(
            null, System.TimeSpan.MaxValue, true));

        // Get the methods in the class
        MethodDataCollection methods =
            c.Methods;

        // display the methods
        Console.WriteLine("Method Names: ");
        foreach (MethodData method in methods)
        {
            Console.WriteLine(method.Name);
        }
        Console.WriteLine();

        // Get the properties in the class
        PropertyDataCollection properties =
            c.Properties;

        // display the properties
        Console.WriteLine("Property Names: ");
        foreach (PropertyData property in properties)
        {
            Console.WriteLine(property.Name);
        }
        Console.WriteLine();

        // Get the Qualifiers in the class
        QualifierDataCollection qualifiers =
            c.Qualifiers;

        // display the qualifiers
        Console.WriteLine("Qualifier Names: ");
        foreach (QualifierData qualifier in qualifiers)
        {
            Console.WriteLine(qualifier.Name);
        }
    }
}
Imports System.Management


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

        ' Get the WMI class
        ' Options specify that amended qualifiers
        ' should be retrieved along with the class
        Dim c As New ManagementClass("\\MyBox\root\cimv2", _
            "Win32_Environment", _
            New ObjectGetOptions( _
            Nothing, System.TimeSpan.MaxValue, True))


        ' Get the methods in the class
        Dim methods As MethodDataCollection
        methods = c.Methods

        ' display the methods
        Console.WriteLine("Method Names: ")
        For Each method As MethodData In methods

            Console.WriteLine(method.Name)
        Next
        Console.WriteLine()

        ' Get the properties in the class
        Dim properties As PropertyDataCollection
        properties = c.Properties

        ' display the properties
        Console.WriteLine("Property Names: ")
        For Each p As PropertyData In properties

            Console.WriteLine(p.Name)
        Next
        Console.WriteLine()

        ' Get the Qualifiers in the class
        Dim qualifiers As QualifierDataCollection = _
        c.Qualifiers()

        ' display the qualifiers
        Console.WriteLine("Qualifier Names: ")
        For Each qualifier As QualifierData In qualifiers

            Console.WriteLine(qualifier.Name)
        Next

    End Function
End Class

설명

경로는 전체 경로(서버 및 네임스페이스 포함)로 지정할 수 있습니다. 그러나 scope 지정되면 전체 경로의 첫 번째 부분을 재정의합니다.

.NET Framework 보안

직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분적으로 신뢰할 수 있는 코드에서 라이브러리를 사용 하 여입니다.

적용 대상