Jump to content

Unique computer key


 Share

Recommended Posts

How do i see the output of this to test? i tried MSG box but it said $serialnumber was undeclaired

That's what we use in our company

Func getpcserialnumber()
; Generated by AutoIt Scriptomatic
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"
$Output=""
$Output = $Output & "Computer: " & $strComputer  & @CRLF
$Output = $Output & "==========================================" & @CRLF
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
if $objWMIService=0 then
 ;lognio("ERROR: WMI corrupted on workstation, cannot get the information.")
 return -1
endif

$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", _
                                           $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
    For $objItem In $colItems
        $serialnumber = $objItem.SerialNumber
    Next
Else
    $serialnumber=-1
Endif
return $serialnumber
endfunc

muppet hands are so soft :)

Link to comment
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
 Share

  • Recently Browsing   0 members

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