Jump to content
Sign in to follow this  
Digisoul

unique ID for System(PC)

Recommended Posts

Digisoul

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

Share this post


Link to post
Share on other sites
trancexx

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

Share this post


Link to post
Share on other sites
rasim

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

Share this post


Link to post
Share on other sites
fctd

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]

Share this post


Link to post
Share on other sites
maqleod

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

Share this post


Link to post
Share on other sites
fctd

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]

Share this post


Link to post
Share on other sites
maqleod

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

Share this post


Link to post
Share on other sites
Manjish

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

Share this post


Link to post
Share on other sites
trancexx

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

Share this post


Link to post
Share on other sites
Manjish

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

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
FireFox

@Digisoul

Or... use only random number and letters for long string and youre sure its unique :lmao:

:)

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
rasim

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

Share this post


Link to post
Share on other sites
rasim

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.

Share this post


Link to post
Share on other sites
FireFox

@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

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
rasim

@rasim

Are you asking a question ?

No.

picaxe

Good example, thanks :)

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
FireFox

$guid = StringReplace(StringTrimLeft(StringTrimRight(_CreateGuid(), 1), 1), '-', '')oÝ÷ Ù«­¢+ØÀÌØíÕ¥ôMÑÉ¥¹IÁ±¡MÑÉ¥¹IÁ±¡MÑÉ¥¹IÁ±¡}
ÉÑÕ¥ ¤°ÅÕ½ÐíìÅÕ½Ðì°ÌäìÌä줰ÅÕ½ÐíôÅÕ½Ðì°ÌäìÌä줰ÅÕ½Ðì´ÅÕ½Ðì°ÌäìÌäì¤

:)

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×