ManagementBaseObject.ClassPath Property


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

Gets the path to the management object's class.

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

public virtual ManagementPath ClassPath { get; }

Property Value

Type: System.Management.ManagementPath

Returns a ManagementPath that contains the class path to the management object's class.

A ManagementPath that represents the path to the management object's class.

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 code lists all the classes with their class paths in the root\CIMV2 namespace.

For the \\MyBox\root\cimv2:Win32_LogicalDisk= 'C:' object, the class path is \\MyBox\root\cimv2:Win32_LogicalDisk.

using System;
using System.Management;

public class Sample 
    public static void Main() 
        // Create a query for classes
        SelectQuery query = 
            new SelectQuery("SELECT * FROM meta_class");

        // Initialize an object searcher with this query
        ManagementObjectSearcher searcher = 
            new ManagementObjectSearcher(query);

        // Get the resulting collection and loop through it
        foreach (ManagementObject classObject in searcher.Get()) 

.NET Framework
Available since 1.1
Return to top