Aracılığıyla paylaş


ManagementClass Oluşturucular

Tanım

ManagementClass sınıfının yeni bir örneğini başlatır.

Aşırı Yüklemeler

ManagementClass()

ManagementClass sınıfının yeni bir örneğini başlatır. Bu, parametresiz oluşturucudur.

ManagementClass(ManagementPath)

ManagementClass sınıfının yeni bir örneğini başlatır. sınıfı, bir disk sürücüsünü temsil eden Win32_LogicalDisk gibi WMI'den bir Ortak Bilgi Modeli (CIM) yönetim sınıfını ve Notepad.exe gibi bir işlemi temsil eden Win32_Process temsil eder.

ManagementClass(String)

Verilen yola başlatılan sınıfın ManagementClass yeni bir örneğini başlatır. sınıfı, bir disk sürücüsünü temsil eden Win32_LogicalDisk gibi WMI'den bir Ortak Bilgi Modeli (CIM) yönetim sınıfını ve Notepad.exe gibi bir işlemi temsil eden Win32_Process temsil eder.

ManagementClass(ManagementPath, ObjectGetOptions)

Belirtilen seçenekleri kullanarak verilen WMI sınıfı yolunda başlatılan sınıfın yeni bir örneğini ManagementClass başlatır. sınıfı, bir disk sürücüsünü temsil eden Win32_LogicalDisk gibi WMI'den bir Ortak Bilgi Modeli (CIM) yönetim sınıfını ve Notepad.exe gibi bir işlemi temsil eden Win32_Process temsil eder.

ManagementClass(SerializationInfo, StreamingContext)
Geçersiz.

ve StreamingContext sınıflarının ManagementClass belirtilen örneklerinden sınıfının yeni bir örneğini SerializationInfo başlatır.

ManagementClass(String, ObjectGetOptions)

Belirtilen seçenekleri kullanarak verilen WMI sınıfı yolunda başlatılan sınıfın yeni bir örneğini ManagementClass başlatır. sınıfı, bir disk sürücüsünü temsil eden Win32_LogicalDisk gibi WMI'den bir Ortak Bilgi Modeli (CIM) yönetim sınıfını ve Notepad.exe gibi bir işlemi temsil eden Win32_Process temsil eder.

ManagementClass(ManagementScope, ManagementPath, ObjectGetOptions)

Belirtilen kapsamda ve belirtilen seçeneklerle belirtilen WMI sınıfı için sınıfının yeni bir örneğini ManagementClass başlatır. sınıfı, bir disk sürücüsünü temsil eden Win32_LogicalDisk gibi WMI'den bir Ortak Bilgi Modeli (CIM) yönetim sınıfını ve Notepad.exe gibi bir işlemi temsil eden Win32_Process temsil eder.

ManagementClass(String, String, ObjectGetOptions)

Belirtilen WMI sınıfı için belirtilen kapsamda ve belirtilen seçeneklerle sınıfının yeni bir örneğini ManagementClass başlatır. sınıfı, bir disk sürücüsünü temsil eden Win32_LogicalDisk gibi WMI'den bir Ortak Bilgi Modeli (CIM) yönetim sınıfını ve Notepad.exe gibi bir işlemi temsil eden Win32_Process temsil eder.

Açıklamalar

.NET Framework Güvenliği

Anında arayanlar için tam güven. Bu üye kısmen güvenilen kodla kullanılamaz. Daha fazla bilgi için bkz. Kısmen Güvenilen Koddan Kitaplıkları Kullanma.

ManagementClass()

Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs

ManagementClass sınıfının yeni bir örneğini başlatır. Bu, parametresiz oluşturucudur.

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

Örnekler

Aşağıdaki örnek, parametresiz oluşturucu ile bir ManagementClass değişkeni başlatma örneğidir ManagementClass . Örnekte, oluşturulan sınıf için yöntemler, özellikler ve niteleyiciler listelenir.

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

Açıklamalar

.NET Framework Güvenliği

Anında arayanlar için tam güven. Bu üye kısmen güvenilen kodla kullanılamaz. Daha fazla bilgi için bkz. Kısmen Güvenilen Koddan Kitaplıkları Kullanma.

Şunlara uygulanır

ManagementClass(ManagementPath)

Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs

ManagementClass sınıfının yeni bir örneğini başlatır. sınıfı, bir disk sürücüsünü temsil eden Win32_LogicalDisk gibi WMI'den bir Ortak Bilgi Modeli (CIM) yönetim sınıfını ve Notepad.exe gibi bir işlemi temsil eden Win32_Process temsil eder.

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)

Parametreler

path
ManagementPath

ManagementPath Bağlanılacak WMI sınıfını belirten. parametresi bir WMI sınıf yolu belirtmelidir. sınıfı WMI'dan bir CIM yönetim sınıfını temsil eder. CIM sınıfları donanım, yazılım, işlemler vb. gibi yönetim bilgilerini temsil eder. Windows'da kullanılabilen CIM sınıfları hakkında daha fazla bilgi için bkz. CIM Sınıfları.

Örnekler

Aşağıdaki örnek, bir ManagementClass değişkeni oluşturucuyla ManagementClass başlatma örneğidir. Örnekte, oluşturulan sınıf için yöntemler, özellikler ve niteleyiciler listelenir.

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

Açıklamalar

parametresi bir path WMI sınıf yolu belirtmelidir.

.NET Framework Güvenliği

Anında arayanlar için tam güven. Bu üye kısmen güvenilen kodla kullanılamaz. Daha fazla bilgi için bkz. Kısmen Güvenilen Koddan Kitaplıkları Kullanma.

Şunlara uygulanır

ManagementClass(String)

Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs

Verilen yola başlatılan sınıfın ManagementClass yeni bir örneğini başlatır. sınıfı, bir disk sürücüsünü temsil eden Win32_LogicalDisk gibi WMI'den bir Ortak Bilgi Modeli (CIM) yönetim sınıfını ve Notepad.exe gibi bir işlemi temsil eden Win32_Process temsil eder.

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

Parametreler

path
String

WMI sınıfının yolu. sınıfı WMI'dan bir CIM yönetim sınıfını temsil eder. CIM sınıfları donanım, yazılım, işlemler vb. gibi yönetim bilgilerini temsil eder. Windows'da kullanılabilen CIM sınıfları hakkında daha fazla bilgi için bkz. CIM Sınıfları.

Örnekler

Aşağıdaki örnekte bir ManagementClass değişkenin oluşturucuyla ManagementClass nasıl başlatılmış olduğu gösterilmektedir. Örnekte, oluşturulan sınıf için yöntemler, özellikler ve niteleyiciler listelenir.

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

Açıklamalar

.NET Framework Güvenliği

Anında arayanlar için tam güven. Bu üye kısmen güvenilen kodla kullanılamaz. Daha fazla bilgi için bkz. Kısmen Güvenilen Koddan Kitaplıkları Kullanma.

Şunlara uygulanır

ManagementClass(ManagementPath, ObjectGetOptions)

Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs

Belirtilen seçenekleri kullanarak verilen WMI sınıfı yolunda başlatılan sınıfın yeni bir örneğini ManagementClass başlatır. sınıfı, bir disk sürücüsünü temsil eden Win32_LogicalDisk gibi WMI'den bir Ortak Bilgi Modeli (CIM) yönetim sınıfını ve Notepad.exe gibi bir işlemi temsil eden Win32_Process temsil eder.

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)

Parametreler

path
ManagementPath

ManagementPath WMI sınıf yolunu temsil eden bir örnek. sınıfı WMI'dan bir CIM yönetim sınıfını temsil eder. CIM sınıfları donanım, yazılım, işlemler vb. gibi yönetim bilgilerini temsil eder. Windows'da kullanılabilen CIM sınıfları hakkında daha fazla bilgi için bkz. CIM Sınıfları.

options
ObjectGetOptions

ObjectGetOptions Bu sınıf alınırken kullanılacak seçenekleri temsil eden bir.

Örnekler

Aşağıdaki örnek, bir ManagementClass değişkeni oluşturucuyla ManagementClass başlatma örneğidir. Örnekte, oluşturulan sınıf için yöntemler, özellikler ve niteleyiciler (değiştirilmiş niteleyiciler dahil) listelenir.

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

Açıklamalar

.NET Framework Güvenliği

Anında arayanlar için tam güven. Bu üye kısmen güvenilen kodla kullanılamaz. Daha fazla bilgi için bkz. Kısmen Güvenilen Koddan Kitaplıkları Kullanma.

Şunlara uygulanır

ManagementClass(SerializationInfo, StreamingContext)

Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs

Dikkat

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

ve StreamingContext sınıflarının ManagementClass belirtilen örneklerinden sınıfının yeni bir örneğini SerializationInfo başlatır.

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)

Parametreler

info
SerializationInfo

Yeni ManagementClassserileştirmek için gereken bilgileri içeren sınıfının bir örneğiSerializationInfo.

context
StreamingContext

Yeni ManagementClassile ilişkili serileştirilmiş akışın kaynağını içeren sınıfının bir örneğiStreamingContext.

Öznitelikler

Açıklamalar

.NET Framework Güvenliği

Anında arayanlar için tam güven. Bu üye kısmen güvenilen kodla kullanılamaz. Daha fazla bilgi için bkz. Kısmen Güvenilen Koddan Kitaplıkları Kullanma.

Şunlara uygulanır

ManagementClass(String, ObjectGetOptions)

Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs

Belirtilen seçenekleri kullanarak verilen WMI sınıf yolunda başlatılan sınıfın yeni bir örneğini ManagementClass başlatır. sınıfı, bir disk sürücüsünü temsil eden Win32_LogicalDisk ve Notepad.exe gibi bir işlemi temsil eden Win32_Process gibi WMI'dan bir Ortak Bilgi Modeli (CIM) yönetim sınıfını temsil eder.

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)

Parametreler

path
String

WMI sınıfının yolu. sınıfı WMI'dan bir CIM yönetim sınıfını temsil eder. CIM sınıfları donanım, yazılım, işlemler vb. gibi yönetim bilgilerini temsil eder. Windows'da kullanılabilen CIM sınıfları hakkında daha fazla bilgi için bkz. CIM Sınıfları.

options
ObjectGetOptions

ObjectGetOptions WMI sınıfı alınırken kullanılacak seçenekleri temsil eden.

Örnekler

Aşağıdaki örnekte bir ManagementClass değişkenin oluşturucuyla ManagementClass nasıl başlatılmış olduğu gösterilmektedir. Örnekte, oluşturulan sınıf için yöntemler, özellikler ve niteleyiciler (değiştirilmiş niteleyiciler dahil) listelenir.

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

Açıklamalar

.NET Framework Güvenliği

Anında arayanlar için tam güven. Bu üye kısmen güvenilen kodla kullanılamaz. Daha fazla bilgi için bkz. Kısmen Güvenilen Koddan Kitaplıkları Kullanma.

Şunlara uygulanır

ManagementClass(ManagementScope, ManagementPath, ObjectGetOptions)

Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs

Belirtilen kapsamda ve belirtilen seçeneklerle belirtilen WMI sınıfı için sınıfının yeni bir örneğini ManagementClass başlatır. sınıfı, bir disk sürücüsünü temsil eden Win32_LogicalDisk ve Notepad.exe gibi bir işlemi temsil eden Win32_Process gibi WMI'dan bir Ortak Bilgi Modeli (CIM) yönetim sınıfını temsil eder.

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)

Parametreler

scope
ManagementScope

ManagementScope WMI sınıfının bulunduğu kapsamı (sunucu ve ad alanı) belirten bir.

path
ManagementPath

ManagementPath Belirtilen kapsamdaKI WMI sınıfının yolunu temsil eden bir. sınıfı WMI'dan bir CIM yönetim sınıfını temsil eder. CIM sınıfları donanım, yazılım, işlemler vb. gibi yönetim bilgilerini temsil eder. Windows'da kullanılabilen CIM sınıfları hakkında daha fazla bilgi için bkz. CIM Sınıfları.

options
ObjectGetOptions

ObjectGetOptions WMI sınıfı alınırken kullanılacak seçenekleri belirten bir.

Örnekler

Aşağıdaki örnek, bir ManagementClass değişkenin oluşturucuyla nasıl başlatılmış olduğunu gösteren bir ManagementClass örnektir. Örnekte, oluşturulan sınıf için yöntemler, özellikler ve niteleyiciler (değiştirilmiş niteleyiciler dahil) listelenir. Örneğin bilgisayarınızda düzgün çalışması için koddaki kapsamı (ad alanını) değiştirmeniz gerekir.

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

Açıklamalar

Yol tam yol olarak belirtilebilir (sunucu ve ad alanı dahil). Ancak, bir kapsam belirtilirse, tam yolun ilk bölümünü geçersiz kılar.

.NET Framework Güvenliği

Anında arayanlar için tam güven. Bu üye kısmen güvenilen kodla kullanılamaz. Daha fazla bilgi için bkz. Kısmen Güvenilen Koddan Kitaplıkları Kullanma.

Şunlara uygulanır

ManagementClass(String, String, ObjectGetOptions)

Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs
Kaynak:
ManagementClass.cs

Belirtilen WMI sınıfı için, belirtilen kapsamda ve belirtilen seçeneklerle sınıfının yeni bir örneğini ManagementClass başlatır. sınıfı, bir disk sürücüsünü temsil eden Win32_LogicalDisk ve Notepad.exe gibi bir işlemi temsil eden Win32_Process gibi WMI'dan bir Ortak Bilgi Modeli (CIM) yönetim sınıfını temsil eder.

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)

Parametreler

scope
String

WMI sınıfının bulunduğu kapsam.

path
String

Belirtilen kapsamdaki WMI sınıfının yolu. sınıfı WMI'dan bir CIM yönetim sınıfını temsil eder. CIM sınıfları donanım, yazılım, işlemler vb. gibi yönetim bilgilerini temsil eder. Windows'da kullanılabilen CIM sınıfları hakkında daha fazla bilgi için bkz. CIM Sınıfları.

options
ObjectGetOptions

ObjectGetOptions WMI sınıfı alınırken kullanılacak seçenekleri belirten bir.

Örnekler

Aşağıdaki örnekte bir ManagementClass değişkenin oluşturucuyla ManagementClass nasıl başlatılmış olduğu gösterilmektedir. Örnekte, oluşturulan sınıf için yöntemler, özellikler ve niteleyiciler (değiştirilmiş niteleyiciler dahil) listelenir. Örneğin bilgisayarınızda düzgün çalışması için koddaki kapsamı (ad alanını) değiştirmeniz gerekir.

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

Açıklamalar

Yol tam yol olarak belirtilebilir (sunucu ve ad alanı dahil). Ancak, bir kapsam belirtilirse, tam yolun ilk bölümünü geçersiz kılar.

.NET Framework Güvenliği

Anında arayanlar için tam güven. Bu üye kısmen güvenilen kodla kullanılamaz. Daha fazla bilgi için bkz. Kısmen Güvenilen Koddan Kitaplıkları Kullanma.

Şunlara uygulanır