Skip to content

Instantly share code, notes, and snippets.

@dreikanter
Created October 16, 2013 14:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dreikanter/7008389 to your computer and use it in GitHub Desktop.
Save dreikanter/7008389 to your computer and use it in GitHub Desktop.
Getting unique system ID
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