Missing directive or assembly reference using WMI ManagementObjectSearcher?

I found this link:

Detecting antivirus on Windows using C #

However, when I try to use this code in Visual C # Express Edition 2008, it says:

Error 1 The type or namespace name 'ManagementObjectSearcher' could not be found 
(are you missing a using directive or an assembly reference?) 
C:\Users\Andy\Documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs 15 17 ConsoleApplication1

Among other similar errors on 2 lines that seem important!

Does the code segment seem to be missing any import or something else?

I am using Windows 7 ... Please help!

Andy

+5
source share
1 answer

You are missing a reference to an assembly containing a type ManagementObjectSearcherthat is in the namespace System.Management. Add this namespace and it should work.

→ System.Management. System.Managment .

WMI
WMI + #

+20

All Articles