Good day.
Visual Studio does not want to find the ManagementObjectSearcher. What I just did not try. Changed the .NET version, imported different things. No sense.
I decided to check the info from one article, and it is used for yourself.
managementObjectSearcher SEARCHER11 =
New ManagementObjectSearcher ("Root \\ Cimv2",
"SELECT * from Win32_Videocontroller");
Foreach (ManagementObj in searcher11.get ())
{
Console.WriteLine ("----------- Win32_VideoController Instance -------");
Console.Writeline ("Adapterram: {0}", queryobj ["adapterram"]);
CONSOLE.WRITELINE ("CAPTION: {0}", Queryobj ["Caption"]);
Console.WriteLine ("Description: {0}", Queryobj ["Description"]);
Console.WriteLine ("VideoProcessor: {0}", queryobj ["videoprocessor"]);
}
I get as a result:
The Type or Namespace Name ‘ManagementObjectSearcher’ Could Not Be Found (Are You Missing A Using Directive or An Assembly Reference?)
Import System.Management is. (System.management.dll does not find, although somewhere wrote that this is a solution to the problem.)
What should I do? : /
Answer 1, Authority 100%
Open your project, click right-click on References in the solutions browser for this project. In the drop-down list, choose “Add Reference”. A dialog box appears in front of you in which the Assemblies section in the panel are selecting. There are more assemblies. Among them, find the System.Management assembly. Check it with a daw, click the OK button. Hurray, everything works.
Screenshot: