Results 1 to 1 of 1
  1. #1
    nasty is offline
    New member
    Join Date
    2012 May
    Thanked 4 Times in 3 Posts
    Rep Power

    USB pen drive unique serial generator

    This code id very useful to create a kind of USB protection (using a normal USB pen drive).
    Each Pen Driver generate a different unique ID.
    An example usage can be:
    -1st store oh HD the pen drive seriale
    -2nd compare the inserted pen drive serial with the one stored on HD .. when the serials are the same then 'do something'

    Func _GetDeviceID($drive,$fullid=0)
        $objWMIService = ObjGet("winmgmts:{impersonationLevel=Impersonate}!\\.\root\cimv2")
        If Not IsObj($objWMIService) Then Return -1 ;Failed to Connect to WMI on Local Machine
        $colDevice = $objWMIService.ExecQuery("SELECT * from Win32_LogicalDiskToPartition")
        For $objItem in $colDevice
            If StringInStr($objItem.Dependent,$drive) Then
        If Not $var Then Return -2 ;Failed to Find Drive Letter
        $colDevice = $objWMIService.ExecQuery("SELECT * from Win32_DiskDriveToDiskPartition")
        $diskpartition = $var
        For $objItem in $colDevice
            If StringInStr($objItem.Dependent,$diskpartition) Then
        If Not $var Then Return -3 ;Failed to Find Physical Drive #
        $colDevice = $objWMIService.ExecQuery("SELECT * from Win32_DiskDrive")
        $physicaldrive = StringReplace(StringReplace($var,"\\","\"),'"',"")
        For $objItem in $colDevice
            If $objItem.DeviceID = $physicaldrive Then
        If Not $var Then Return -4 ;Failed to Find DeviceID
        If Not $fullid Then $var = StringTrimLeft($var,StringInstr($var,"\",0,-1)) ;Return Full DeviceID (Full is very dirty)
        Return $var
    Ex. Usage:

    $idCurrent = _GetDeviceID($drive)

Similar Threads

  1. [Release] BOT Cash Generator ACGBF 0.1b
    By themalikao in forum Aika Online
    Replies: 59
    Last Post: 2012-07-14, 12:16 AM
  2. WoW Name Generator
    By BmHeros in forum Trash Bin
    Replies: 0
    Last Post: 2012-01-12, 11:15 PM
  3. [Guide] Unique Features of Battle of the Immortals
    By Dwar in forum Battle of the Immortals
    Replies: 0
    Last Post: 2010-11-22, 01:58 AM
  4. [Guide] Aika Online Unique Prans
    By Dwar in forum Aika Guides, Tutorials
    Replies: 2
    Last Post: 2010-10-29, 04:45 AM
  5. [Guide] Serial Fishing.
    By MrSmith in forum Programming Tutorials
    Replies: 0
    Last Post: 2010-10-22, 01:12 PM
Visitors found this page by searching for:

autoit usb

autoit usb device id

autoit generate unique id

autoit ptotection usb

how to view pendrive unique code

usb autoit

how to read an unique identification number of pendrive

autoit script to find pen drive

code generator au3

what is the unique code in pendrive

where is the id generation for pendrive

read an unique identification number of pendrive

autoit is drive usb

autoit usb drive

autoit unique usb identity


autoit drive get serial

pendrive unique codes

get flash drive serial number autoit


find usb with autoit

autoit script find usb drive letter

autoit usb drive serial

autoit get usb device id

autoit drive id

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts