Another Problem ... but Namespace \root\cimv2.

  • Thread starter Thread starter SnakeS
  • Start date Start date
S

SnakeS

When I do:

using ROOT.CIMV2.Win32;

the class there isn't.

This namespace or class I didn't find it.

How i using this classes?
 
SnakeS said:
When I do:

using ROOT.CIMV2.Win32;

the class there isn't.

This namespace or class I didn't find it.

How i using this classes?

Where did you read about this namespace? It looks like it's in someone
else's assembly, in which case you need to get the assembly and add a
reference to it in the project.
 
I've take this from:

ms-help://MS.NETFrameworkSDKv1.1/cptools/html/cpgrfmanagementstronglytypedcl
assgeneratormgmtclassgenexe.htm

using System;

using System.Management;

using ROOT.CIMV2.Win32;

public class App

{

public static void Main()

{

// Enumerate instances of the Win32_process.

// Print the Name property of the instance.

foreach(Process ps in Process.GetInstances())

{

Console.WriteLine(ps.Name);

}

// Initialize the instance of LogicalDisk with

// the WMI instance pointing to logical drive d:.

LogicalDisk dskD = new LogicalDisk(new ManagementPath(

"win32_LogicalDisk.DeviceId=\"d:\""));

Console.WriteLine(dskD.Caption);

}

}

Now, for use LogicalDisk or other like classes I must using ROOT.CIMV2 ...
Or no?

Thanks in advance
 
Hi,

ROOT.CIMV2.Win32 is a WMI namespace, not a .NET namespace.
Reference the managed WMI wrapper by the following statement:

using System.Management;

And then, for example, use the SelectQuery class to gain access to the WMI
objects.
You can also use the ManagementPath class to work with WMI namespaces.
 
Please post such questions to ...
microsoft.public.dotnet.Framework.Wmi
is a specialized NG for System.Management and WMI related questions?

Willy.
 
Back
Top