Need help finding a unique PC ID.

  • Thread starter Thread starter dave m
  • Start date Start date
D

dave m

I need to be able to retrieve a unique ID from a users PC. I needs to be
something a user could not easily change, like the computer name. Could
someone point me in the right direction to find the information found in
Windows system information? Or maybe there is a better method.

Thanks in advance for any help or suggestions.

Dave M.
 
dave m said:
I need to be able to retrieve a unique ID from a users PC. I needs to be
something a user could not easily change, like the computer name. Could
someone point me in the right direction to find the information found in
Windows system information? Or maybe there is a better method.

There is not a single unique ID. Some CPUs have an ID, other machines which
have a network card have a (hopefully) unique MAC ID, ...

I am curious why you would want to determine a unique ID. Maybe there is a
better solution.
 
Thanks for the reply! I'd like to have a method tell how many PCs at a
site are running a particular application of ours. My thinking would be to
store this unique ID in a database on a server that these networked PCs
connect to. Then I could tell how many seats are using the application,
When they are using it, and for how long.

Dave M.
 
dave m said:
I'd like to have a method tell how many PCs at a site are running a
particular application of ours. My thinking would be to store this
unique ID in a database on a server that these networked PCs connect to.

If your application is used in-house, then you can maybe utilize the MAC ID
of the machines' network cards:

<URL:http://groups.google.de/groups?q=mac+id+dotnet>
 
Herfried is right; there's really isn't a good "unique" identifier for a machine. In the recent past, the industry wanted to add some unique identifiers to CPUs, but privacy issues led to a reconsideration of that plan. (Thus I second Herfried's comments -- maybe there's a better solution for what you're trying to do.)

Incidentally, getting the machine name is simple enough when using the newly released VS2005 (which you can check out for free, in Express Edition form, from http://msdn.microsoft.com/vstudio/express) -- something like the following would work:

Dim s as string = My.Computer.Name

--Matt Gertz--*
VB Compiler Dev Lead

-----Original Message-----
From: Herfried K. Wagner [MVP]
Posted At: Monday, November 14, 2005 12:16 PM
Posted To: microsoft.public.dotnet.languages.vb
Conversation: Need help finding a unique PC ID.
Subject: Re: Need help finding a unique PC ID.


dave m said:
I need to be able to retrieve a unique ID from a users PC. I needs to be
something a user could not easily change, like the computer name. Could
someone point me in the right direction to find the information found in
Windows system information? Or maybe there is a better method.

There is not a single unique ID. Some CPUs have an ID, other machines which
have a network card have a (hopefully) unique MAC ID, ...

I am curious why you would want to determine a unique ID. Maybe there is a
better solution.
 
Here is the babelfish translation for that page

Hello Davide!

in the news contribution
I wanted to ask, whether and how it is possible in VB.NET the SID one
operating system to select (those, which one changes with the Clonen by means of Sysprep
should).

According to Marks of Russiovic
http://www.sysinternals.com/ntw2k/source/newsid.shtml

the Machine SID is in the RegistryKey
SECURITY\SAM\Domains\Account

This key has a binary value V and the last 96 bits contained that
Key.

To this key you come however only, if your program under that
System account runs. That is thus no passable way. Into regedit.exe see
You the key also only, if you regedit.exe under the system account
, small trick starts: start a command line and tap then

RK < time > /interactive regedit

, thus for example

RK 19:20 /interactive regedit

Then starts around 19:20 under the system account and you see that regedit
Key also.

You know however the program PsGetSid
http://www.sysinternals.com/ntw2k/freeware/psgetsid.shtml

use and the output parsen, similar to for instance for the last example
here:
http://groups.google.de/[email protected]...

Or in addition, this code use:

' reference on system management DLL set!
Import system management

Private Function GetMachineSid() As stringer
Dim query As ObjectQuery = _
New ObjectQuery(_
"SELECT * from Win32_UserAccount where Name='Administrator '")
Dim of searcher As ManagementObjectSearcher = _
New ManagementObjectSearcher(query)
Dim moc As ManagementObjectCollection = _
searcher.Get()
Dim sid As stringer
For Each mo As ManagementObject in moc
sid = mo("sid")
NEXT one

Dim pattern As stringer = _
"(?<MachineSid>\w-\d-\d-\d{2}-\d{10}-\d{10}-\d{10})"
Dim move As Regex = new Regex(pattern)
Dim mc As MatchCollection = reg.Matches(sid)
Return mc(0).Groups("MachineSid").Value
End to Function

This code gets itself the SID of the administrator and uses the Pattern,
over
to filter the Machine SID, those in the user SID of the administrator
is always contained. I hope that I described the Pattern correctly
, on that me accessible computers it has perfectly functioned.

Details to SIDs by the way give it in the outstanding book

The NET Developer's Guide ton of Windows Security
By Keith Brown

Publisher: Addison Wesley
Pub DATE: Septembers 27, 2004
ISBN: 0-321-22835-9
Pages: 408

http://www.awprofessional.com/title/0321228359

Greeting

Arne Janning

Arne said:
Hi Herfried!



Should the machine SID not be unique as well? I'm not 100% sure but I think
so.

Getting the machine SID in VB.NET:
http://groups.google.de/group/microsoft.public.de.german.entwickler.dotnet.vb/msg/2bfd79f4560ddc1b

(In german, just have a look at the code)

Cheers

Arne Janning

--

Kind Regards

David Huisman
General Manager
-----------------------------------------------------------------------
ORBIT COMMUNICATIONS Pty Ltd - Wireless Solutions that Work
(Telemetry, Control, Monitoring, Security, HVAC ...)
A.C.N. 107 441 869


Website : http://www.orbitcoms.com
PO Box 4474 Lakehaven
NSW 2263, AUSTRALIA
Phone: 61-2-4393-3627
Fax : 61-2-4393-3685
Mobile: 61-413-715-986
 
Arne,

Arne Janning said:
Should the machine SID not be unique as well? I'm not 100% sure but I
think so.

Yes, SIDs are AFAIK globally unique too.

BTW: At least parts of Keith Brown's book are available online:

What Is A SID?
<URL:http://pluralsight.com/wiki/default.aspx/Keith.GuideBook/WhatIsASID.html>

Determining the SID using .NET Framework 2.0:

How To Program With SIDs
<URL:http://pluralsight.com/wiki/default.aspx/Keith.GuideBook/HowToProgramWithSIDs.html>

IIRC SIDs are only supported on NT-based operating systems, so using them as
unique identifiers will not work if machines running Windows 98 or Windows
Me are used.
 
Hi,

In the registry there also is a machine guid key in the
hkey_local_machine\software\microsoft\crytography registry key.

Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top