All day I try to write the code, or how it does not work! Help with the example WORKERS, who would show the number of the mat. fees.

I'll tell you the idea, I want to identify each computer by some parameter, if you have other ideas, write.

    1 answer 1

    The standard method is a WMI query. If WMI contains a number, it will be retrieved.

    var results = new ManagementObjectSearcher("SELECT SerialNumber FROM Win32_BaseBoard"); foreach (var board in results.Get()) { foreach (var property in board.Properties) Console.WriteLine("{0} = {1}", property.Name, property.Value); } 

    But, unfortunately, not all boards have it. Therefore, it is better to take another parameter, such as the MAC address or processor number.

     foreach (var ni in NetworkInterface.GetAllNetworkInterfaces()) { Console.WriteLine(ni.GetPhysicalAddress()); } 
    • Swears on ManagementObjectSearcher, says can't find one, and I'm using System.Management; hooked up and so on all day ... - johniek_comp
    • one
      It is not enough to specify using , you also need to add a link to the System.Management assembly. - stanislav
    • so I added: using System; using System.Management; doesn't want to find anyway ... - johniek_comp pm
    • I copy the example completely with msdn, the compiler does not want to find a ManagementObjectSearcher, although I work not in VS, but in SharpDeveloper, is there a difference? - johniek_comp
    • @johniek_comp So you didn’t add it there! It is necessary to add the System.Management.dll library to References, it is not connected by default, then. - stanislav