daily pastebin goal
42%
SHARE
TWEET

generate unique computer identifier sample

tolikpunkoff May 5th, 2018 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  public static class cCHID
  2.     {
  3.         public static string GetCHID()
  4.         {
  5.             string CHID = "";
  6.  
  7.             ManagementObjectSearcher searcher;
  8.  
  9.             //processor
  10.             searcher = new ManagementObjectSearcher("root\\CIMV2",
  11.                    "SELECT * FROM Win32_Processor");
  12.             foreach (ManagementObject queryObj in searcher.Get())
  13.                 CHID = CHID + queryObj["ProcessorId"].ToString() + "_";
  14.  
  15.             //mainboard id
  16.             searcher = new ManagementObjectSearcher("root\\CIMV2",
  17.                    "SELECT * FROM CIM_Card");
  18.             foreach (ManagementObject queryObj in searcher.Get())
  19.                 CHID = CHID + queryObj["SerialNumber"].ToString() + "_";
  20.  
  21.             //OS serial number
  22.             searcher = new ManagementObjectSearcher("root\\CIMV2",
  23.                    "SELECT * FROM CIM_OperatingSystem");
  24.             foreach (ManagementObject queryObj in searcher.Get())
  25.                 CHID = CHID + queryObj["SerialNumber"].ToString();
  26.  
  27.             return CHID;
  28.         }
  29.  
  30.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top