Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Getting a computer unique string


  • Please log in to reply
58 replies to this topic

#21 LxP

LxP

    Real satisfaction in every glass.

  • Active Members
  • PipPipPipPipPipPip
  • 1,621 posts

Posted 26 November 2005 - 12:17 PM

No, I have no problem with your solution -- that's the thing.

What I meant by my remark was that no solution will guarantee unique results from every computer in the world, but your solution seems to come closer to that than the others.







#22 Buffo

Buffo

    Adventurer

  • Active Members
  • PipPip
  • 112 posts

Posted 26 November 2005 - 12:33 PM

Oh, I see. I misunderstood your reply ;-)

Regards.
Buffo

#23 JerryD

JerryD

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 251 posts

Posted 26 November 2005 - 01:55 PM

All the responses look great - especially the processor ID. However, it's relatively easy to change the processor, and where I work we frequently get machines back from repair with no serial number, model name, manufacturer in the Bios (where WMI gets the info).

However, I rarely see machines with invalid (typically all F's or zeros) UUID's - and haven't seen a blank one yet.

Here's a small script that uses the function _ComputerUUID() to get the computer's UUID:
; Generated by AutoIt Scriptomatic MsgBox ( 0, @ScriptName, _ComputerUUID() ) Func _ComputerUUID( $strComputer="localhost" )     $wbemFlagReturnImmediately = 0x10     $wbemFlagForwardOnly = 0x20     $colItems = ""     $sRetUUID=""     $objWMIService = ObjGet ( "winmgmts:\\" & $strComputer & "\root\CIMV2" )     $colItems = $objWMIService.ExecQuery ( "SELECT * FROM Win32_ComputerSystemProduct", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly )     If IsObj ( $colItems ) then        For $objItem In $colItems           $sRetUUID = $objItem.UUID        Next     Else        SetError ( 1 )        Return $sRetUUID     Endif     Return $sRetUUID EndFunc


#24 BigDod

BigDod

    The Mayor of Mirth

  • Jokers
  • 8,631 posts

Posted 26 November 2005 - 01:58 PM

All the responses look great - especially the processor ID. However, it's relatively easy to change the processor, and where I work we frequently get machines back from repair with no serial number, model name, manufacturer in the Bios (where WMI gets the info).

However, I rarely see machines with invalid (typically all F's or zeros) UUID's - and haven't seen a blank one yet.

Here's a small script that uses the function _ComputerUUID() to get the computer's UUID:

; Generated by AutoIt Scriptomatic MsgBox ( 0, @ScriptName, _ComputerUUID() ) Func _ComputerUUID( $strComputer="localhost" )     $wbemFlagReturnImmediately = 0x10     $wbemFlagForwardOnly = 0x20     $colItems = ""     $sRetUUID=""     $objWMIService = ObjGet ( "winmgmts:\\" & $strComputer & "\root\CIMV2" )     $colItems = $objWMIService.ExecQuery ( "SELECT * FROM Win32_ComputerSystemProduct", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly )     If IsObj ( $colItems ) then        For $objItem In $colItems           $sRetUUID = $objItem.UUID        Next     Else        SetError ( 1 )        Return $sRetUUID     Endif     Return $sRetUUID EndFunc

Mine returns all F's

Time you enjoyed wasting is not wasted time ......T.S. Elliot

Suspense is worse than disappointment................Robert Burns

God help the man who won't help himself, because no-one else will...........My Grandmother

Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.BigDod2.gifbd1.png


#25 erebus

erebus

    Quod me nutrit me destruit.

  • Active Members
  • PipPipPipPipPipPip
  • 454 posts

Posted 26 November 2005 - 08:02 PM

@JerryD: Mine returns all F's too.

@Buffo: Your workaround could be great and I really like it. However consider that in machines that are "ghosted" this workaround will have no effect at all. In this way you must have done a clean installation on each machine to get a unique ID from these files you mentioned.

In any case what I would propose is to combine several things in one string such as:

The HD's serial
The processor's ID
The MAC address (if a NIC is present)

...and the length of other non-numerical strings like:

Processor's name
System name
Processor's manufacturer name
Processor's description

...etc etc.

By adding only numbers of ready serials or of the length of alphanumerical strings (that are always unique) will have our unique serial number that can be MD5 hashed afterwards.

Edit: Ah, you may also consider adding the date numbers that Buffo mentioned as well. I think you got the point, the more the better.

Better?

Edited by erebus, 26 November 2005 - 08:08 PM.


#26 Amen

Amen

    Wayfarer

  • Active Members
  • Pip
  • 78 posts

Posted 03 December 2005 - 06:13 PM

In my situation the uniq id must be data that easily a person(or customer) can give.Another thing.All pcs are ghosted (obviously Operating ids and date files are the same).And then like spanga said this id must not depends an an computer part.(If this part damaged and replaced we have problem) I think ip and public ip for a lan is the best thing to look. So i choose to Look ip for Authentication and send data to my computer after a while(if prog succefully runned) with the public ip.Just to know who is using my prog.Question: Should i look also Gateway for athentication? Gateway is always uniq for a Lan such as Internet caffe? (TO avoid illigan use of my program) This must be depending of the way someone has built the lan .A lan on a store can probably have the same ips with another store.But gateway must be different.am I right?

Edited by Amen, 03 December 2005 - 06:27 PM.


#27 erebus

erebus

    Quod me nutrit me destruit.

  • Active Members
  • PipPipPipPipPipPip
  • 454 posts

Posted 14 December 2005 - 12:52 AM

No, you are not.

It is very usual in several LANs (and in internet cafes too) to use the private ip of a common router as a gateway (like 192.168.1.1 for Zyxel, 10.0.0.138 for Alcatel/Thomson, 192.168.0.1 for some others, etc.).

We rarely change the default router's IP and the only case to find public IPs set in Windows network settings is the case to use these IPs outside your router settings and widely set in your LAN (meaning that instead of routing with your router to route from each Windows box).

#28 seandisanti

seandisanti

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 2,927 posts

Posted 14 December 2005 - 12:56 AM

You could use the computer serialnumber

; Get the serial number and asset tag of a computer ; 25 November 2005 by Geert (NL) ; Translated VBScript source code: <a href='http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_tasks__computer_hardware.asp' class='bbc_url' title='External link' rel='nofollow external'>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_tasks__computer_hardware.asp</a> ; AutoIt 3.1.x Beta needed $strComputer = "." $objWMIService = ObjGet("winmgmts:" _     & "{impersonationLevel=impersonate}!\\" _     & $strComputer & "\root\cimv2") $colSMBIOS = $objWMIService.ExecQuery _     ("Select * from Win32_SystemEnclosure") For $objSMBIOS in $colSMBIOS     MsgBox(0,"","Part Number: " & $objSMBIOS.PartNumber)     MsgBox(0,"","Serial Number: " & $objSMBIOS.SerialNumber)     MsgBox(0,"","Asset Tag: " & $objSMBIOS.SMBIOSAssetTag) Next

i was going to say home drive serial...
1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

#29 PerryRaptor

PerryRaptor

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 383 posts

Posted 14 December 2005 - 04:01 AM

System UUID on replacement motherboards and quite a number of AMD-based boards have either all F's or all 0's.

Also Part#, Serial#, and Tag # may be all 0's or 1234567890 on replacement boards.

I think a combination of data joined together should do the trick...Consider ComputerName + MAC + Time that OS had been installed should be somewhat unique.

#30 themax90

themax90

    A new beginning

  • Active Members
  • PipPipPipPipPipPip
  • 1,265 posts

Posted 14 December 2005 - 04:34 AM

Computer name and MAC can be spoofed. I am using a FileGetTime of Creation method for 2 required none editable system files.

#31 JSThePatriot

JSThePatriot

    carpe diem. vita brevis.

  • MVPs
  • 3,692 posts

Posted 14 December 2005 - 05:11 AM

Basic point.

There isnt going to be something that is totally unique. You will have to probably take many of the above suggestions and combine them. To make a semi-unique string. You could then convert that string to a numerical form run a formula to shorten the string, and then convert back to a new string. Make that the unique value.

There isnt going to be a fool proof way just like bullet proof glass can still be broken. Just its harder.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)


#32 themax90

themax90

    A new beginning

  • Active Members
  • PipPipPipPipPipPip
  • 1,265 posts

Posted 14 December 2005 - 06:55 AM

Point made :P

Well done JS, if you would like to post my ClientAuthID UniqueID funcs on your behalf you can :lmao: After all I got ideas from your quotes.

#33 nobby

nobby

    Prodigy

  • Active Members
  • PipPipPip
  • 188 posts

Posted 14 December 2005 - 07:15 AM

Another way is to get the computer SID, which will not be unique if the PC's are cloned and are not joined to a domain. The SID on cloned PCs can be changed with ease.

NB system files on cloned PC's will have the same creation and modification date.

Will this provide an absolute unique ID? NO, but nothing will. Even NIC's can have a duplicate MAC address, despite manufacturer having to request MAC ranges from an international association.

If the idea is to ensure unique ID on your network only, this will work.

Read SID, www.sysinternal.com
Change SID, www.sysinternal.com
CheersNobby

#34 JSThePatriot

JSThePatriot

    carpe diem. vita brevis.

  • MVPs
  • 3,692 posts

Posted 14 December 2005 - 08:10 AM

Point made :P

Well done JS, if you would like to post my ClientAuthID UniqueID funcs on your behalf you can :lmao: After all I got ideas from your quotes.


Do I detect a bit of sarcasim? :(

If you think it would possibly help then yes please post it.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)


#35 nfwu

nfwu

    I'm not active on these forums

  • Active Members
  • PipPipPipPipPipPip
  • 1,234 posts

Posted 14 December 2005 - 12:16 PM

Adding (most) of what you all said together allows me to produce these two UDFs:
Plain Text         
;=============================================================================== ; ; _UniqueWoodID( $com, $no ) ; Description:      Used to generate a nearly "unique" ID for a computer ; Parameter(s):     [optional] $com : name of computer to generate ID for (default=localhost) ;                   [optional] $no : shortening value used to shorten id(default: 5) ; Requirement:      AutoIt ; Return Value(s):  The ID for the computer ; Author(s):        Alexander "TechDude" Wood ; Note(s):          Use the SAME shortening value every time you call this function. ;                  I feel that _UniqueWoodID2() is more unique than this ; ;=============================================================================== #Include <String.au3> Func _UniqueWoodID( $com = "localhost", $no = 5 ) ;$time = TimerInit()     $colItems = ""     $objWMIService = ObjGet ("winmgmts:\\" & $com & "\root\CIMV2")     $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_Processor", "WQL", 0x10 + 0x20)     If IsObj ($colItems) Then         For $objItem In $colItems             $Out1 = _StringEncrypt(1, $objItem.AddressWidth & $objItem.Architecture & $objItem.Caption, _                     $objItem.ConfigManagerErrorCode & $objItem.ConfigManagerUserConfig & $objItem.DataWidth)             $Out2 = _StringEncrypt(1, $objItem.Description & $objItem.DeviceID & $objItem.ExtClock, _                     $objItem.Family & $objItem.InstallDate & $objItem.L2CacheSize)             $Out3 = _StringEncrypt(1, $objItem.L2CacheSpeed & $objItem.Level & $objItem.Manufacturer, _                     $objItem.MaxClockSpeed & $objItem.Name & $objItem.OtherFamilyDescription)             $Out4 = _StringEncrypt(1, $objItem.PNPDeviceID & $objItem.ProcessorId & $objItem.ProcessorType, _                     $objItem.Revision & $objItem.Role & $objItem.SocketDesignation)             $Out5 = _StringEncrypt(1, $objItem.SystemCreationClassName & $objItem.SystemName & $objItem.UniqueId, _                     $objItem.UpgradeMethod & $objItem.Version & $objItem.VoltageCaps)             $Output = $Out1 & $Out2 & $Out3 & $Out4 & $Out5 & _WoodIDhelper2()             $Output = _WoodIDhelper( $Output, $no )         ;MsgBox(0, "Unique Wood's ID", $Output)         ;MsgBox(0, "Timer", TimerDiff( $time ))             Return $Output             ExitLoop;;Only want first match (will have more matches for multipule processor/multithreaded systems)         Next     Else         MsgBox(0, "Unique Wood's ID - ERROR", "No WMI Objects Found for class: " & "Win32_Processor")         Exit -1         Return     EndIf EndFunc  ;==>_UniqueWoodID ;=============================================================================== ; ; _UniqueWoodID2( $com, $no ) ; Description:      Used to generate a nearly "unique" ID for a computer ; Parameter(s):     [optional] $com : name of computer to generate ID for (default=localhost) ;                   [optional] $no : shortening value (default: 2 ) ; Requirement:      AutoIt ; Return Value(s):  The Wood's ID for the computer ; Author(s):        Alexander "TechDude" Wood ; Note(s):          Use the SAME shortening value every time you call this function. ; ;=============================================================================== Func _UniqueWoodID2( $com = "localhost", $no = 2 ) ;$time = TimerInit()     $colItems = ""     $objWMIService = ObjGet ("winmgmts:\\" & $com & "\root\CIMV2")     $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_Processor", "WQL", 0x10 + 0x20)     If IsObj ($colItems) Then         For $objItem In $colItems             $Out1 = $objItem.AddressWidth & $objItem.Architecture & $objItem.Caption & _                     $objItem.ConfigManagerErrorCode & $objItem.ConfigManagerUserConfig & $objItem.DataWidth             $Out2 = $objItem.Description & $objItem.DeviceID & $objItem.ExtClock & _                     $objItem.Family & $objItem.InstallDate & $objItem.L2CacheSize             $Out3 = $objItem.L2CacheSpeed & $objItem.Level & $objItem.Manufacturer & _                     $objItem.MaxClockSpeed & $objItem.Name & $objItem.OtherFamilyDescription             $Out4 = $objItem.PNPDeviceID & $objItem.ProcessorId & $objItem.ProcessorType & _                     $objItem.Revision & $objItem.Role & $objItem.SocketDesignation             $Out5 = $objItem.SystemCreationClassName & $objItem.SystemName & $objItem.UniqueId & _                     $objItem.UpgradeMethod & $objItem.Version & $objItem.VoltageCaps             $Output = $Out1 & $Out2 & $Out3 & $Out4 & $Out5 & _WoodIDhelper2()             $Output = _WoodIDhelper3( _WoodIDhelper( $Output, $no ) )         ;MsgBox(0, "Unique Wood's ID", $Output)         ;MsgBox(0, "Timer", TimerDiff( $time ))             Return $Output             ExitLoop;;Only want first match (will have more matches for multipule processor/multithreaded systems)         Next     Else         MsgBox(0, "Unique Wood's ID - ERROR", "No WMI Objects Found for class: " & "Win32_Processor")         Exit -1         Return     EndIf EndFunc  ;==>_UniqueWoodID2 Func _WoodIDhelper( $str, $no=1 );;Used to shorten the string     If ($no < 1) Or ($no == 1) then Return $str     $str = StringSplit( $str, "" )     Local $ret = ""     For $i = 1 to $str[0] Step $no         $ret &= $str[$i]     Next     Return $ret EndFunc Func _WoodIDhelper2()     Return FileGetTime( @HomeDrive & "\io.sys", 1, 1 ) & FileGetTime( @HomeDrive & "\recycler", 1, 1 ) & FileGetTime( @HomeDrive & "\LocalService\ntuser.ini", 1, 1 ) EndFunc Func _WoodIDhelper3($str)     $str = StringSplit( $str, @TAB & " ,_()"& @CR & @LF )     Local $ret = ""     For $i = 1 to $str[0]         $ret &= $str[$i]     Next     Return StringUpper( $ret ) EndFunc


Note that the smaller the $no value, the longer the string, but the greater the uniqueness.
Samples:
MsgBox(0, "Version 2 of Wood's Unique ID - $no of 1", _UniqueWoodID2("localhost", 1)) MsgBox(0, "Version 2 of Wood's Unique ID - $no of 2(default)", _UniqueWoodID2()) MsgBox(0, "Version 1 of Wood's Unique ID - $no of 1", _UniqueWoodID("localhost", 1)) MsgBox(0, "Version 1 of Wood's Unique ID - $no of 5(default)", _UniqueWoodID2())


According the the Timing provided by TimerInit() and TimerDiff(), it takes slightly less than 2100 milliseconds of it to calculate the Unique computer ID.

#36 layer

layer

    i love skateboarding

  • Active Members
  • PipPipPipPipPipPip
  • 2,470 posts

Posted 30 December 2005 - 02:34 AM

sorry to bring up the old topic... maybe i should have researched this, but if the systems you're using have the system restore tool then you can read this: C:\WINDOWS\system32\Restore\MachineGuid.txt

is all i know is that my system has that (windows xp home edition), and im pretty sure someone mentioned a Guid being nearly if not impossible to reproduce

i see you have some udf's working for you, but i came accross this and remebered this thread :P

Edited by layer, 30 December 2005 - 02:34 AM.

FootbaG

#37 JerryD

JerryD

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 251 posts

Posted 17 January 2006 - 10:40 AM

sorry to bring up the old topic... maybe i should have researched this, but if the systems you're using have the system restore tool then you can read this: C:\WINDOWS\system32\Restore\MachineGuid.txt

is all i know is that my system has that (windows xp home edition), and im pretty sure someone mentioned a Guid being nearly if not impossible to reproduce

i see you have some udf's working for you, but i came accross this and remebered this thread :lmao:

I was surfing around, and came across a very easy way to generate a GUID.
Plain Text         
;=============================================================================== ; ; Function Name:    _GenGUID() ; Description:    Generates a GUID (globally unique identifier) ; Parameter(s):  None ; Requirement(s):   AutiIt 3.1.1 Beta (tested with version 101) ; Return Value(s):  On Success - Returns a string with the GUID ;                  On Failure - ''  and sets @ERROR = 1 ; Author(s):        JerryD ; Reference:        http://www.microsoft.com/technet/scriptcenter/resources/qanda/feb05/hey0221.mspx ; ;=============================================================================== Func _GenGUID()     Local $sRetGUID     $TypeLib = ObjCreate ( 'Scriptlet.TypeLib' )     If IsObj( $TypeLib ) Then         $sRetGUID = $TypeLib.Guid         $TypeLib = ''         Return $sRetGUID     Else         $TypeLib = ''         SetError(1)         Return ''     EndIf EndFunc  ;==>_GenGUID

BTW - I'm running System Resotre, and don't find MachineGuid.txt anywhere. Maybe it's only generated when you actually perform a restore which I've never done, plus I'm running XP Pro.
Jerry

Modified to release object after reading SvenP's comments in How to release an object reference

Edited by JerryD, 17 January 2006 - 11:33 AM.


#38 Celeri

Celeri

    Prodigy

  • Active Members
  • PipPipPip
  • 157 posts

Posted 21 January 2006 - 07:33 PM

You could use the computer serialnumber

; Get the serial number and asset tag of a computer ; 25 November 2005 by Geert (NL) ; Translated VBScript source code: <a href='http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_tasks__computer_hardware.asp' class='bbc_url' title='External link' rel='nofollow external'>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_tasks__computer_hardware.asp</a> ; AutoIt 3.1.x Beta needed $strComputer = "." $objWMIService = ObjGet("winmgmts:" _     & "{impersonationLevel=impersonate}!\\" _     & $strComputer & "\root\cimv2") $colSMBIOS = $objWMIService.ExecQuery _     ("Select * from Win32_SystemEnclosure") For $objSMBIOS in $colSMBIOS     MsgBox(0,"","Part Number: " & $objSMBIOS.PartNumber)     MsgBox(0,"","Serial Number: " & $objSMBIOS.SerialNumber)     MsgBox(0,"","Asset Tag: " & $objSMBIOS.SMBIOSAssetTag) Next

Whooo ! Great to be back :lmao:

Ok well, this didn't work on my computer - I got generic values for everything.

Mind you one thing that might be arguably be better as a reference is ....
well without saying it, one could "hitch a ride" with Microsoft...
hint --> what's the same on each install, is different for each user and can be found within the registry?
hint --> FCKGW RHQQ2 ...
I am endeavoring, ma'am, to construct a mnemonic circuit using stone knives and bearskins.SpockMy UDFs:Deleted - they were old and I'm lazy ... :)My utilities:Comment stripperPolicy lister 1.07AutoIT Speed Tester (new!)

#39 theguy0000

theguy0000

    Benevolent Dictator

  • Active Members
  • PipPipPipPipPipPip
  • 3,750 posts

Posted 21 January 2006 - 07:41 PM

beats me ;)

Matt :lmao:
The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

#40 ACalcutt

ACalcutt

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 307 posts

Posted 22 January 2006 - 12:08 AM

i not sure....but isn't the windows product id unique?

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProductId

Andrew Calcutt

Http://www.Vistumbler.net

Http://www.TechIdiots.net

Its not an error, its a undocumented feature





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users