ManagementClass Constructor (ManagementPath)


Initializes a new instance of the ManagementClass class. 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(
	ManagementPath path


Type: System.Management.ManagementPath

A ManagementPath specifying the WMI class to which to bind. The parameter must specify a WMI class path. 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

The path parameter must specify a WMI class 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 is an example of how to initialize a ManagementClass variable with a ManagementClass constructor. The example lists the methods, properties, and qualifiers for the created class.

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 =

        // 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