-
September 30th, 2005, 12:47 PM
#1
Computer Unique ID?
Hello everyone
Is there any unique alpha numeric code that is used to identify each copy of windows or computer? If there is, then where it is stored. If it is in the registry, please provide the key location. Thanks for any help.
-
October 3rd, 2005, 01:40 AM
#2
Re: Computer Unique ID?
You can use MAC address of NIC of your computer. It must be unique, otherwise the computer cannot work on network. For inspiration how to obtain MAC address you can use following code:
Code:
using System;
using System.Management;
namespace WMI
{
class Class1
{
static void Main(string[] args)
{
ManagementObjectSearcher query1;
ManagementObjectCollection queryCollection1;
query1 = new ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapter") ;
queryCollection1 = query1.Get();
foreach( ManagementObject mo in queryCollection1 )
{
Console.Write(mo["caption"].ToString());
Console.Write(" MAC: ");
object mac = mo["MACAddress"];
if (mac != null) Console.Write(mac.ToString());
Console.WriteLine();
}
}
}
}
- Make it run.
- Make it right.
- Make it fast.
Don't hesitate to rate my post.
-
October 3rd, 2005, 09:22 AM
#3
Re: Computer Unique ID?
I don't know what you're intentions are, but maybe you can use System.Guid.NewGuid()
http://msdn.microsoft.com/library/de...classtopic.asp
I've never actually used it before, but according to most sources I read about GUID's, they usually use a combination of MAC Addresses, milliseconds since a particular time frame, and IP Addresses. However, that's irrelevant as the only important aspect of a GUID that is necessary to use one is that it's unique.
You can do something like
Code:
Console.WriteLine("GUID : {0}", System.Guid.NewGuid());
Although, this may or may not work for you. This will generate Unique Identifiers, but whether or not you're trying to generate UniqueIDs or are actually trying to find the UniqueIDs already assigned to a computer is two different stories.
Jason Isom
.NET 2.0 / VS2005 Developer
-
October 3rd, 2005, 01:00 PM
#4
Re: Computer Unique ID?
Thanks for the help.
I am trying to make my program running on one system only. It does not allow to run on multiple computers. I am still thinking of a solution
-
October 4th, 2005, 08:58 AM
#5
Re: Computer Unique ID?
Probably reading MAC address would be your solution. But beware that MAC address could be spoofed. You might want to read several identifiers like MAC, IP and make combination of it as unique PC identifier
"We act as though comfort and luxury were the chief requirements of
life, when all that we need to make us happy is something to be
enthusiastic about."
- Einstein
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|