Digisoul Posted January 15, 2009 Posted January 15, 2009 Hi Guys, Is there any way to get any unique ID, Serial or code for PC ? I want to be sure that the program never run again after the demo end, on the users PC? 73 108 111 118 101 65 117 116 111 105 116
rasim Posted January 15, 2009 Posted January 15, 2009 Example: $RunPID = Run(@ComSpec & " /c wmic csproduct get UUID", @SystemDir, @SW_HIDE, 0x2) Dim $sRead While 1 $sRead &= StdoutRead($RunPID) If @error Then ExitLoop WEnd $sUUID = StringRegExp($sRead, "[\d-]+", 1) If @error Then Exit $sUUID = $sUUID[0] MsgBox(64, "Computer Universally Unique Identifer", $sUUID)
trancexx Posted January 15, 2009 Posted January 15, 2009 Example: $RunPID = Run(@ComSpec & " /c wmic csproduct get UUID", @SystemDir, @SW_HIDE, 0x2) Dim $sRead While 1 $sRead &= StdoutRead($RunPID) If @error Then ExitLoop WEnd $sUUID = StringRegExp($sRead, "[\d-]+", 1) If @error Then Exit $sUUID = $sUUID[0] MsgBox(64, "Computer Universally Unique Identifer", $sUUID) What regular expression is that? What it means? ♡♡♡ . eMyvnE
rasim Posted January 16, 2009 Posted January 16, 2009 trancexxHi! The above regular expression means, that we search for a set of any digit (0-9) and the "-" (dash) symbol. "+" means: Repeat the previous character, set or group 1 or more times.
fctd Posted January 16, 2009 Posted January 16, 2009 My UUID is "2". Is that my unique ID of the PC? [list][font="Century Gothic"]If nothing is certain, everything is possible.[/font][/list][font="Century Gothic"]Experience is something you get, just after you need it.[/font]
maqleod Posted January 16, 2009 Posted January 16, 2009 well, you can check for the serial of their HDD, you can check their windows key (certainly not as good), you can check their mac address for their primary network adapter, or lastly, the hwid. [u]You can download my projects at:[/u] Pulsar Software
fctd Posted January 16, 2009 Posted January 16, 2009 Im not familiar with it, but cant you write something unique to the register? Greetings. [list][font="Century Gothic"]If nothing is certain, everything is possible.[/font][/list][font="Century Gothic"]Experience is something you get, just after you need it.[/font]
maqleod Posted January 16, 2009 Posted January 16, 2009 Im not familiar with it, but cant you write something unique to the register?Greetings.yes, but I believe he was looking for a means that was as difficult to work around as possible, which I would suggest the HDD serial, but even that, to the dedicated, has a work around.You are best off taking a selection of several unique identifiers to make a key that would be too much trouble to change (ie, HDD serial + Windows Key + mac address + hwid). [u]You can download my projects at:[/u] Pulsar Software
Manjish Posted January 16, 2009 Posted January 16, 2009 yes, but I believe he was looking for a means that was as difficult to work around as possible, which I would suggest the HDD serial, but even that, to the dedicated, has a work around.You are best off taking a selection of several unique identifiers to make a key that would be too much trouble to change (ie, HDD serial + Windows Key + mac address + hwid).Hey why don't u use the service tag of the m/c..u can easily search it thru WMIn its absolutely unique.every m/c has it, n the manufacturers keep it unique [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
trancexx Posted January 16, 2009 Posted January 16, 2009 trancexx Hi! The above regular expression means, that we search for a set of any digit (0-9) and the "-" (dash) symbol. "+" means: Repeat the previous character, set or group 1 or more times. Actually, there were question inside my question. I thought you would get it. My remark written in Autoit was this: $RunPID = Run(@ComSpec & " /c wmic.exe csproduct get UUID", "", @SW_HIDE, 0x2) Dim $sRead While Not @error $sRead &= StdoutRead($RunPID) WEnd MsgBox(64, "Computer Universally Unique Identifer", $sRead) So, your regexp is way off. Further more, you are using wmic.exe for unknown reasons, to me anyway. That app is made for batch programming and similar stuff. AutoIt is above that by miles. Your code should have been something like this: MsgBox(64, "Computer Universally Unique Identifer", _GetUUID()) Func _GetUUID() Local $oWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\localhost\root\cimv2") If Not IsObj($oWMIService) Then Return SetError(1, 0, -1) EndIf Local $oSysProd = $oWMIService.ExecQuery("Select * From Win32_ComputerSystemProduct") For $oSysProp In $oSysProd Return SetError(0, 0, $oSysProp.UUID) Next Return SetError(2, 0, -1) EndFunc Related link They say it's easy to be general after the battle. I think I've just prove that (this is on me, but never mind) ♡♡♡ . eMyvnE
Manjish Posted January 16, 2009 Posted January 16, 2009 u ended up using wmi, just the way i had suggested!! cool [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Moderators SmOke_N Posted January 16, 2009 Moderators Posted January 16, 2009 Unfortunately, this will fail on 50% of PC's (not everyone has WMI active). I've often looked for a pure API method, from what I've read, you'd have to dig in the net bios and dig out the high and low time. I've never gotten it to work this way though. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
FireFox Posted January 16, 2009 Posted January 16, 2009 @Digisoul Or... use only random number and letters for long string and youre sure its unique Cheers, FireFox.
rasim Posted January 17, 2009 Posted January 17, 2009 My UUID is "2". Is that my unique ID of the PC?Hmm... strange, what happens if you type this in the Windows console? wmic.exe csproduct get UUID
rasim Posted January 17, 2009 Posted January 17, 2009 Actually, there were question inside my question. I thought you would get it. My remark written in Autoit was this: $RunPID = Run(@ComSpec & " /c wmic.exe csproduct get UUID", "", @SW_HIDE, 0x2) Dim $sRead While Not @error $sRead &= StdoutRead($RunPID) WEnd MsgBox(64, "Computer Universally Unique Identifer", $sRead) So, your regexp is way off. Further more, you are using wmic.exe for unknown reasons, to me anyway. That app is made for batch programming and similar stuff. AutoIt is above that by miles. Your code should have been something like this: MsgBox(64, "Computer Universally Unique Identifer", _GetUUID()) Func _GetUUID() Local $oWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\localhost\root\cimv2") If Not IsObj($oWMIService) Then Return SetError(1, 0, -1) EndIf Local $oSysProd = $oWMIService.ExecQuery("Select * From Win32_ComputerSystemProduct") For $oSysProp In $oSysProd Return SetError(0, 0, $oSysProp.UUID) Next Return SetError(2, 0, -1) EndFunc Related link They say it's easy to be general after the battle. I think I've just prove that (this is on me, but never mind)Without parsing using the StringRegExp I get this: But I need to get only number, without unnecessary strings.
FireFox Posted January 17, 2009 Posted January 17, 2009 (edited) @rasim Are you asking a question ? StringReplace($UUID, '-', '')oÝ÷ Úg¥v+ZºÚ"µÍÌÍÕURQHÝ[ÔÜ] Ý[Õ[SY ÑÙ]URQ K KÔBÝ[ÔXÙJ ÌÍÕURQÌK ÌÎNËIÌÎNË ÌÎNÉÌÎNÊ Not tested Cheers, FireFox. Edited January 17, 2009 by FireFox
picaxe Posted January 17, 2009 Posted January 17, 2009 From the forums#Include <WinAPI.au3> MsgBox(4096, "Generate Guid", _CreateGuid()) Func _CreateGuid() Local $Guid = DllStructCreate($tagGUID) $Result = DllCall("OLE32.DLL", "dword", "CoCreateGuid", "ptr", DllStructGetPtr($Guid)) $Result = _WinAPI_StringFromGUID(DllStructGetPtr($Guid)) Return $Result EndFunc
rasim Posted January 17, 2009 Posted January 17, 2009 @rasimAre you asking a question ?No.picaxeGood example, thanks
Moderators SmOke_N Posted January 17, 2009 Moderators Posted January 17, 2009 Without parsing using the StringRegExp I get this: But I need to get only number, without unnecessary strings.I think this was what you were looking to do: Local $s_out = "" Local $i_pid = Run(@ComSpec & " /c wmic csproduct get UUID", @SystemDir, @SW_HIDE, 6) While 1 $s_out &= StdoutRead($i_pid) If @error Then ExitLoop WEnd $s_out = StringRegExpReplace($s_out, "(?s)(.*?)(\w+-\w+-\w+-\w+-\w+)(.*?\z)", "$2") ConsoleWrite($s_out & @CRLF)One mistake was it's not just digits on the return.... Mine returns alpha numeric. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
FireFox Posted January 17, 2009 Posted January 17, 2009 $guid = StringReplace(StringTrimLeft(StringTrimRight(_CreateGuid(), 1), 1), '-', '')oÝ÷ Ù«¢+ØÀÌØíÕ¥ôMÑÉ¥¹IÁ±¡MÑÉ¥¹IÁ±¡MÑÉ¥¹IÁ±¡} ÉÑÕ¥ ¤°ÅÕ½ÐíìÅÕ½Ðì°ÌäìÌä줰ÅÕ½ÐíôÅÕ½Ðì°ÌäìÌä줰ÅÕ½Ðì´ÅÕ½Ðì°ÌäìÌäì¤ Cheers, FireFox.
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