xarzu
xarzu

Reputation: 9489

How do I use WMI in C#

the compiler does not recognize SelectQuery api and ManagementObjectSearcher. According to what I can see in the online examples, all I need to do is to add

using System.Management

as a namespace

Upvotes: 1

Views: 1267

Answers (1)

Reed Copsey
Reed Copsey

Reputation: 564771

You also need to add a reference in your project to System.Management.dll.

You can see this for any class by looking at the documentation on MSDN. Note this:

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

This means you'll want to add a using System.Management; in order to import the namespace, but also that it requires a reference to System.Management.dll.

Upvotes: 3

Related Questions