Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

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. :)

Posted

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]

Posted

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
Posted

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]

Posted

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
Posted

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 WMI

n 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
Posted

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. :lmao:

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

Posted

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
Posted

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.

Posted

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
Posted

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:

Posted Image

But I need to get only number, without unnecessary strings.

Posted (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 by FireFox
  • Moderators
Posted

Without parsing using the StringRegExp I get this:

Posted Image

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...