Break On
Dim $SO
$SO = SetOption('Explicit', 'On')
$SO = SetOption('NoVarsInStrings', 'On')
$SO = SetOption('NoMacrosInStrings', 'On')
Dim $Chk, $MyBIOSInfo
Dim $Mfg, $Model, $Ser, $Esc
;$Chk = WMIConfirm('computer name')
;If $Chk
$MyBIOSInfo = GetBIOSInfo()
If VarType($MyBIOSInfo) > 8
$Mfg = $MyBIOSInfo[0]
'Mfg: ' + $Mfg ?
$Model = $MyBIOSInfo[1]
'Model: ' + $Model ?
$Ser = $MyBIOSInfo[2]
'Serial / Tag number: ' + $Ser ?
$Esc = BaseConverter($Ser, 36, 10)
'Express Service Code: ' + $Esc ?
Else
'Error getting BIOS information. ' + @ERROR + ' - ' + @SERROR ?
EndIf
;Else
; 'Error accessing WMI. ' + @ERROR + ' - ' + @SERROR ?
;EndIf
Sleep 20
Function WMIConfirm(optional $sComputer)
Dim $objWMIService, $objWMISetting, $colWMISettings
$sComputer = IIf(Not $sComputer, '', '\\' + Join(Split($sComputer, '\'), '', 3) + '\')
$objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!" + $sComputer + 'root\cimv2')
; Failed - return 0 and exit with error value
If @ERROR
$WMIConfirm = 0
Exit Val('&' + Right(DecToHex(@ERROR), 4))
EndIf
$colWMISettings = $objWMIService.ExecQuery("Select * from Win32_WMISetting")
For Each $objWMISetting in $colWMISettings
$WMIConfirm = $objWMISetting.BuildVersion
Next
Exit 0
EndFunction
Function GetBIOSInfo(optional $sComputer)
Dim $objWMIService, $Mfg, $Model, $Ser
Dim $M, $S, $SerialNumber, $Manufacturer
$objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!" + $sComputer + 'root\cimv2')
If @ERROR
$GetBIOSInfo = 0
Exit Val('&' + Right(DecToHex(@ERROR), 4))
EndIf
$Mfg = $objWMIService.ExecQuery("Select * from Win32_ComputerSystem",, 48)
$Ser = $objWMIService.ExecQuery("Select * from Win32_BIOS",, 48)
For Each $M in $Mfg
If $M
$Manufacturer = Trim($M.Manufacturer)
$Model = Trim($M.Model)
EndIf
Next
For Each $S in $Ser
If $S
$SerialNumber = Trim($S.SerialNumber)
EndIf
Next
$GetBIOSInfo = $Manufacturer, $Model, $SerialNumber
Exit 0
EndFunction
Function BaseConverter($v, $f, $t)
Dim $, $e, $y, $n, $x, $z
$ = 0
$t = $ + $t
$f = $ + $f
$e = ($f > 36) | ( $t > 36 ) | ( $f < 2 ) | ( $t < 2 )
$y = 1.
For $n = Len($v) to 1 step - 1
$x = Asc(UCase(SubStr($v, $n, 1)))
$z = ($x - 48 - ($x > 64) * 7)
If ($z < 0) | ( ($x > 57) & ( $x < 65 ) ) | $e | ( $z > ( $f - 1 ) )
Exit 1
EndIf
$ = $y * $z + $
$y = $y * $f
Next
$n = ""
While $
$x = Int($ - (Int($ / $t) * $t))
$ = ($ - $x) / $t
$n = Chr($x + 48 + ($x > 9) * 7) + $n
Loop
$BaseConverter = $n
EndFunction