Created
October 16, 2013 14:12
-
-
Save dreikanter/7008389 to your computer and use it in GitHub Desktop.
Getting unique system ID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Management; | |
namespace UniqueSystemIdentifier | |
{ | |
class Program | |
{ | |
private static string GetSystemID() | |
{ | |
var search = new ManagementObjectSearcher(String.Format("SELECT * FROM Win32_Processor")); | |
foreach (var manObj in search.Get()) | |
{ | |
return manObj.GetPropertyValue("ProcessorID").ToString(); | |
} | |
throw new InvalidOperationException("Oh noes! There are no CPU!"); | |
} | |
static void Main(string[] args) | |
{ | |
Console.WriteLine(GetSystemID()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment