'ManagementClass' does not exist in the namespace 'System.Management'
I think the issue here is that you don't have a proper "pointer" to the System.Management assembly. You must:
- Use a using statement - in some of your code, you didn't prefix classes w/ System.Management, so you should either include:
a.)
using System.Management
or
b.) a using block
using(System.Management) { //your code goes here}
Next, you need to have a real assembly reference. To do this in Visual Studio, right click on your project (or on References) in the Solution Explorer window and click Add Reference. After the list tabulates, find System.Management.dll in the .NET tab. Once you add it, it should work!
In the solution explorer:
- add reference
- find and add system.management in .NET class
that's it