I'm trying to create a fingerprint of a machine fetching certain information from the hardware that is unique to it. For example, a hard drives serial number.
So I'd like to fetch X amount of information and hash it. This hash will be saved remotely on a whitelist that the client would have to consult with before actually running the application.
How do I get this information using C# and .NET 3.5?
First up, I've tried fetching the MAC address of the machine, but on my machine this raises a NullReferenceException:
static void Main(string[] args)
{
ManagementClass oMClass = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection colMObj = oMClass.GetInstances();
foreach (ManagementObject objMO in colMObj)
{
Console.WriteLine(objMO["MACAddress"].ToString());
}
Console.ReadKey(true);
}
Any suggestions?