I'm looking for a way to retrieve the user's MachineID or ProcessorID using a VB.net WinForms app? Any thoughts?
A:
You can access that information using WMI.
string s = "SELECT SerialNumber FROM WIN32_BaseBoard";
System.Management.ManagementObjectSearcher oWMI = new
System.Management.ManagementObjectSearcher(s);
System.Management.ManagementObjectCollection oSerialNumbers = oWMI.Get();
foreach (System.Management.ManagementObject mo in oSerialNumbers)
{
Console.WriteLine("Serial Number: " +
mo.Properties["SerialNumber"].Value.ToString());
}
Referenced from here: http://bytes.com/groups/net/411975-how-can-i-get-processor-id-my-computer
Another example to get processor id is here: http://www.devasp.net/net/articles/display/149.html
RM
2009-02-18 05:31:45
+1
A:
Another option is to get the MAC address of one of the network cards in your system. This is a unique number The following routine gets a mac address of the first network card, and then appends the bytes in the address into a unique ulong (sorry for the C# instead of VB.NET):
using System.Net.NetworkInformation;
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
if (nics.Length != 0)
{
byte[] addressBytes = nics[0].GetPhysicalAddress().GetAddressBytes();
if (addressBytes.Length > 6)
throw new ApplicationException("Unexpected length for MAC address");
ulong address = 0;
foreach (byte b in addressBytes)
{
address
Steve Wranovsky
2009-02-18 05:53:09