spanga Posted November 17, 2005 Share Posted November 17, 2005 Does anyone know a way to get some info that is unique per computer? Like a registry value or something. I have tried the series-number of c: but that aint always unique. I need a unique string for every computer that doesnt change so I can use that in my script for identifying. Link to comment Share on other sites More sharing options...
BigDod Posted November 17, 2005 Share Posted November 17, 2005 Does anyone know a way to get some info that is unique per computer? Like a registry value or something. I have tried the series-number of c: but that aint always unique. I need a unique string for every computer that doesnt change so I can use that in my script for identifying.Here is something I found a while back. I did not write it but I have no idea who did. expandcollapse popup$wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output = $Output & "AddressWidth: " & $objItem.AddressWidth & @CRLF $Output = $Output & "Architecture: " & $objItem.Architecture & @CRLF $Output = $Output & "Availability: " & $objItem.Availability & @CRLF $Output = $Output & "Caption: " & $objItem.Caption & @CRLF $Output = $Output & "ConfigManagerErrorCode: " & $objItem.ConfigManagerErrorCode & @CRLF $Output = $Output & "ConfigManagerUserConfig: " & $objItem.ConfigManagerUserConfig & @CRLF $Output = $Output & "CpuStatus: " & $objItem.CpuStatus & @CRLF $Output = $Output & "CreationClassName: " & $objItem.CreationClassName & @CRLF $Output = $Output & "CurrentClockSpeed: " & $objItem.CurrentClockSpeed & @CRLF $Output = $Output & "CurrentVoltage: " & $objItem.CurrentVoltage & @CRLF $Output = $Output & "DataWidth: " & $objItem.DataWidth & @CRLF $Output = $Output & "Description: " & $objItem.Description & @CRLF $Output = $Output & "DeviceID: " & $objItem.DeviceID & @CRLF $Output = $Output & "ErrorCleared: " & $objItem.ErrorCleared & @CRLF $Output = $Output & "ErrorDescription: " & $objItem.ErrorDescription & @CRLF $Output = $Output & "ExtClock: " & $objItem.ExtClock & @CRLF $Output = $Output & "Family: " & $objItem.Family & @CRLF $Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF $Output = $Output & "L2CacheSize: " & $objItem.L2CacheSize & @CRLF $Output = $Output & "L2CacheSpeed: " & $objItem.L2CacheSpeed & @CRLF $Output = $Output & "LastErrorCode: " & $objItem.LastErrorCode & @CRLF $Output = $Output & "Level: " & $objItem.Level & @CRLF $Output = $Output & "LoadPercentage: " & $objItem.LoadPercentage & @CRLF $Output = $Output & "Manufacturer: " & $objItem.Manufacturer & @CRLF $Output = $Output & "MaxClockSpeed: " & $objItem.MaxClockSpeed & @CRLF $Output = $Output & "Name: " & $objItem.Name & @CRLF $Output = $Output & "OtherFamilyDescription: " & $objItem.OtherFamilyDescription & @CRLF $Output = $Output & "PNPDeviceID: " & $objItem.PNPDeviceID & @CRLF $strPowerManagementCapabilities = $objItem.PowerManagementCapabilities(0) $Output = $Output & "PowerManagementCapabilities: " & $strPowerManagementCapabilities & @CRLF $Output = $Output & "PowerManagementSupported: " & $objItem.PowerManagementSupported & @CRLF $Output = $Output & "ProcessorId: " & $objItem.ProcessorId & @CRLF $Output = $Output & "ProcessorType: " & $objItem.ProcessorType & @CRLF $Output = $Output & "Revision: " & $objItem.Revision & @CRLF $Output = $Output & "Role: " & $objItem.Role & @CRLF $Output = $Output & "SocketDesignation: " & $objItem.SocketDesignation & @CRLF $Output = $Output & "Status: " & $objItem.Status & @CRLF $Output = $Output & "StatusInfo: " & $objItem.StatusInfo & @CRLF $Output = $Output & "Stepping: " & $objItem.Stepping & @CRLF $Output = $Output & "SystemCreationClassName: " & $objItem.SystemCreationClassName & @CRLF $Output = $Output & "SystemName: " & $objItem.SystemName & @CRLF $Output = $Output & "UniqueId: " & $objItem.UniqueId & @CRLF $Output = $Output & "UpgradeMethod: " & $objItem.UpgradeMethod & @CRLF $Output = $Output & "Version: " & $objItem.Version & @CRLF $Output = $Output & "VoltageCaps: " & $objItem.VoltageCaps & @CRLF if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop $Output="" Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_Processor" ) Endif Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc If the auther recognises his/her work they are welcome to the glory. I wish people would put their name at the begining of their scripts. 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 Link to comment Share on other sites More sharing options...
spanga Posted November 17, 2005 Author Share Posted November 17, 2005 I guess this info could be usefull: $Output = $Output & "ProcessorId: " & $objItem.ProcessorId & @CRLF Anyone know if this value always exists and really is unique? What I found out about the volume serial number in windows is that computers with the same specs (like any series of the same brand) had the same volume serials. Link to comment Share on other sites More sharing options...
BigDod Posted November 17, 2005 Share Posted November 17, 2005 I guess this info could be usefull: $Output = $Output & "ProcessorId: " & $objItem.ProcessorId & @CRLF Anyone know if this value always exists and really is unique? What I found out about the volume serial number in windows is that computers with the same specs (like any series of the same brand) had the same volume serials.As far as I am aware the processorid should be unique unless someone else knows better. 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 Link to comment Share on other sites More sharing options...
Amen Posted November 21, 2005 Share Posted November 21, 2005 (edited) Hi spanga.Is proccessor id uniq finally? Edited November 21, 2005 by Amen Plugged ThoughtsQBsick? check my Old staff (New Launchers to Work with Windows.Thnx to Autoit!)Game Development ToolsPortes (A Backgammon game)Ball (An Arkanoid Style game)Au3? SecretProgz - Reveals Commands that can be used on your system CleanOut - Uninstall leftovers Enable windows XP Autologon. Stop Windows Auto Sharing your hard drives (C$,D$,etc) D-Link - Create a dynamic link.Useful for server shortcuts Fun - How would your name sounds in Japanese,Russian or Reventian? Fix_srt - Shift a subtitle (.srt) some secs +/- Link to comment Share on other sites More sharing options...
spanga Posted November 22, 2005 Author Share Posted November 22, 2005 Actually, its very un-unique I tested it out and ALOT of computers got the same processor id, even if its a different model of the same vendor. Atm I am using a big random-function to generate a seed to md5. Then I put it in the registry. That way I hope it wont be changed but it's not a good solution... Link to comment Share on other sites More sharing options...
Shibuya Posted November 22, 2005 Share Posted November 22, 2005 What about MAC address? I believe MAC address is unique IIRC but the computer must have a network adaptor installed though The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!" Link to comment Share on other sites More sharing options...
Confuzzled Posted November 22, 2005 Share Posted November 22, 2005 Here is something I found a while back. I did not write it but I have no idea who did.If the auther recognises his/her work they are welcome to the glory.I wish people would put their name at the begining of their scripts. This looks suspiciously like the output of the Scriptomatic program that generates WMI code. Handy utility... Link to comment Share on other sites More sharing options...
spanga Posted November 24, 2005 Author Share Posted November 24, 2005 The MAC would be a great shot, but I don't like the idea of building this on removeable parts. I guess the serial number of the system harddrive would be a better case. Link to comment Share on other sites More sharing options...
w0uter Posted November 24, 2005 Share Posted November 24, 2005 MAC can be spoofed. so can a HD serial. My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
themax90 Posted November 25, 2005 Share Posted November 25, 2005 (edited) Perhaps this should be taken into consideration? #Include <Inet.au3> #Include <String.au3> MsgBox(0, "Unique ID", GenerateId()) Func GenerateId() #cs; Type 1 $OSLang = StringLeft(@OSLang, 3) $OSVersion = StringRight(@OSVersion, 2) $Id = ($OSLang & "-" & _GetIp() & "-" & $OSVersion & "-" & @OSBuild & "-" & @ProcessorArch) Return _StringEncrypt(1, $ID, @UserName) #ce ;Return _StringEncrypt(1, @UserName _GetIp()); Most Reliable Type 2 ;Return _StringEncrypt(1, _GetIp(), @UserName); Type 3 EndFunc If you look at the text above each finds computer unique values such as operation system(and yes it's unique because not EVERYONE uses the same type/build/etc). Then encrypts it according to certain values and these values can be switched at any given time if you wish to change the way it is formatted. I have found with Type 1 that it returns a rather large string which maybe give unique strings all the time, but seems to have the same few characters/digits in common with Type 3, I do not know if it is the common elemtents and common password or what but I have found that the most reliable and efficent type is Type 2 because it takes not only a GLOBALLY unique ip address but is also encrypts it by the computers logged in user. This thus makes it computer unique AND user unique for issues involving routers and multiple computers on single connection issues. If you do the math and take the maximum amount of Ip addresses in *.*.*.* format which is 4,300,000,000 approx.(4.3 billion!) and combine that with any assortment of letter/digit combination and it comes out to be much larger then anything imaginable. You do the math. Something else to consider is this: _StringEncrypt(1, @OSBuild, _GetIp()) There are THOUSANDS of OSBuilds and it could encrypt that with the unique IP and it works computer wide. So if you are looking for a method of computer unique, this would work, but as far as person unique, the other Type 2 would work just as well. Now it's time for my $0.02! @w0uter Please do not just come up with the enevitable "It can be spoofed", maybe actually try finding an answer instead of "THAT doesn't work, and I wont tell you how" @BigDod Nice code, never seen it anywhere, perhaps it was a while back or something I missed @spanga Thank you for asking a nice question, I spent 10 minutes on it and it actually relaxed me, it was nice and simplistic, find something computer or computer/C-User unique. Nice challenge but not to hard @Confuzzled Very nice interpretation, I bet the person who wrote it didn't write it and just generated it I hope you all have a nice day. Just one thing, please try to attempt it using AutoIt before trying to find something prebuilt. Often Prebuilt things are not answers. Only work arounds. Some of you maybe notice a flaw in the Type 2 GenerateID that a person can simply make more users on there machine and keep going, but then Type 4 comes in if you want directly computer specific. Some noticed the flaw, others didn't, and those who noticed it are more talented then others at scripting. If you were writing a chat environment like I am, use Type 2 for BanCUID(Ban Computer-User ID) and use Type 4 as a BanCID(Computer ID) that way if some stupid kid gets mad at being banned just ban that whole IP address. Of course something like this will be implemented into my chat server I have been working on It has been something I have been thinking of for a while and this thread gave me ideas, thank you very much. AutoIt Smith Edited November 25, 2005 by AutoIt Smith Link to comment Share on other sites More sharing options...
LxP Posted November 25, 2005 Share Posted November 25, 2005 Sorry AutoIt Smith, but IP addresses can vary on a per-connection basis, especially for dialup users. Link to comment Share on other sites More sharing options...
themax90 Posted November 25, 2005 Share Posted November 25, 2005 (edited) Well it was worth a try!!! Perhaps this: $OSLang = StringLeft(@OSLang, 3) $OSVersion = StringRight(@OSVersion, 2) $Id = ($OSLang & "-" &"-" & $OSVersion & "-" & @OSBuild & "-" & @ProcessorArch) $Unique = _StringEncrypt(1, $ID, @UserName); Or _StringEncrypt(1, @UserName, $ID) This way it does not involve ip addresses and the only way to have the same id is exact same everything which probably wouldnt happen much. Just another idea I am sure SOMETHING can be found that is unique and can be generated simply. My point in the previous post was to point out that no one is trying and just saying No that doesn't work instead of giving more then one reason or explaining it. Edited November 25, 2005 by AutoIt Smith Link to comment Share on other sites More sharing options...
Buffo Posted November 25, 2005 Share Posted November 25, 2005 Only an idea:What about adding the times and dates of the following files together to a string:c:\io.sys (it should be the a date/time in the beginning of win setup)c:\recycler (will be created later than boot.ini in dependence of the speed of your inputs while win setup and the pc-speed)@HomeDrive & "\LocalService\ntuser.ini" (will be created between the first two stepsExample (it's german time/date format can vary)C:\io.sys -> 16.08.2005 08:32:26C:\recycler -> 16.08.2005 08:47:32@HomeDrive & "\LocalService\ntuser.ini" -> 16.08.2005 08:42:13Then all points, colons and spaces will be removed and this is your unique ID: 160820050832261608200508473216082005084213I think it nearly will be impossible to get all three values the same.What do you think?Regards,Buffo Link to comment Share on other sites More sharing options...
Geert Posted November 25, 2005 Share Posted November 25, 2005 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: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_tasks__computer_hardware.asp ; 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 Link to comment Share on other sites More sharing options...
themax90 Posted November 25, 2005 Share Posted November 25, 2005 Serial numbers can be spoofed. We need to find a unique string and encrypt or modify it genericly. This unique string needs to be within the computer consisting of CONSTANT values that cannot be spoofed and happen to be one of the most fundemental variables in there system. For example taking everything about the machine, rearranging it and encrypting it will make a unique id. But the question then comes to, Can any of those values be spoofed. If they can then it is not unique. This is a dilemma! Link to comment Share on other sites More sharing options...
themax90 Posted November 25, 2005 Share Posted November 25, 2005 (edited) Could this possibly work? _StringEncrypt(1, StringRight(@OSVersion, 2) & @OSBuild, _StringEncrypt(1, @ProcessorArch, @OSLang)) Or This? _StringEncrypt(1, StringRight(@OSVersion, 2) & @OSLang, @ProcessorArch) Edited November 25, 2005 by AutoIt Smith Link to comment Share on other sites More sharing options...
LxP Posted November 26, 2005 Share Posted November 26, 2005 Buffo, your solution adopting timestamps is ingenious and I can see it being quite effective (perhaps not for the entire world of computers but I suspect that the original poster might want this for e.g. computers within an organisation). Link to comment Share on other sites More sharing options...
Valik Posted November 26, 2005 Share Posted November 26, 2005 Serial numbers can be spoofed.It's a hell of a lot better than your stupid method which will likely produce the exact same results on multiple PC's in workshops where all the hardware is identical (Not uncommon). Link to comment Share on other sites More sharing options...
Buffo Posted November 26, 2005 Share Posted November 26, 2005 (edited) Buffo, your solution adopting timestamps is ingenious and I can see it being quite effective (perhaps not for the entire world of computers but I suspect that the original poster might want this for e.g. computers within an organisation).Where is the problem? The files I mentioned will never be changed. With admin rights you could be able to change the attributes but not with user-rights how it certainly will be in an organisation. But: why?I think it's a very unique thing ;-)_StringEncrypt(1, StringRight(@OSVersion, 2) & @OSBuild, _StringEncrypt(1, @ProcessorArch, @OSLang))_StringEncrypt(1, StringRight(@OSVersion, 2) & @OSLang, @ProcessorArch)What should be unique here? I think at least 75% of the pcs today are xp, most of them with sp2 (build) and there are only 3 different return values of @ProcessorArch...Regards,Buffo Edited November 26, 2005 by Buffo Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now