ManagementClass Constructor (String, String, ObjectGetOptions)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Initializes a new instance of the ManagementClass class for the specified WMI class, in the specified scope, and with the specified options. The class represents a Common Information Model (CIM) management class from WMI such as Win32_LogicalDisk, which can represent a disk drive, and Win32_Process, which represents a process such as Notepad.exe. For more information, see "Win32 Classes" in the Windows Management Instrumentation documentation in the MSDN Library at

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

public ManagementClass(
	string scope,
	string path,
	ObjectGetOptions options


Type: System.String

The scope in which the WMI class resides.

Type: System.String

The path to the WMI class within the specified scope. The class represents a CIM management class from WMI. CIM classes represent management information including hardware, software, processes, and so on. For more information about the CIM classes available in Windows, see "Win32 classes" in the Windows Management Instrumentation documentation in the MSDN Library at

Type: System.Management.ObjectGetOptions

An ObjectGetOptions that specifies the options to use when retrieving the WMI class.

The path can be specified as a full path (including server and namespace). However, if a scope is specified, it will override the first portion of the full path.

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 shows how to initialize a ManagementClass variable with a ManagementClass constructor. The example lists the methods, properties, and qualifiers (including the amended qualifiers) for the created class. You must change the scope (namespace) in the code for the example to run correctly on your computer.

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", 
            new ObjectGetOptions(
            null, System.TimeSpan.MaxValue, true));

        // Get the methods in the class
        MethodDataCollection methods =

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

        // Get the properties in the class
        PropertyDataCollection properties =

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

        // Get the Qualifiers in the class
        QualifierDataCollection qualifiers =

        // display the qualifiers
        Console.WriteLine("Qualifier Names: ");
        foreach (QualifierData qualifier in qualifiers)


.NET Framework
Available since 1.1
Return to top