;===============================================================================
; Description: Returns the System Product information in an array.
; Parameter(s): $aSysProductInfo - By Reference - System Product Information array.
; Requirement(s): None
; Return Value(s): On Success - Returns array of System Product Information.
; $aKeyboardInfo[0][0] = Number of Keyboards
; $aKeyboardInfo[$i][0] = Name ($i starts at 1)
; $aKeyboardInfo[$i][1] = Identifying Number
; $aKeyboardInfo[$i][2] = SKU Number
; $aKeyboardInfo[$i][3] = UUID
; $aKeyboardInfo[$i][4] = Description
; $aKeyboardInfo[$i][5] = Vendor
; $aKeyboardInfo[$i][6] = Version
; On Failure - @error = 1 and Returns 0
; @extended = 1 - Array contains no information
; 2 - $colItems isnt an object
; Author(s): Jarvis Stubblefield (support "at" vortexrevolutions "dot" com)
; Note(s):
;===============================================================================
Func _ComputerGetSystemProduct(ByRef $aSysProductInfo)
Local $colItems, $objWMIService, $objItem
Dim $aSysProductInfo[1][7], $i = 1
$objWMIService = ObjGet("winmgmts:\" & $cI_Compname & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystemProduct", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) Then
For $objItem In $colItems
ReDim $aSysProductInfo[UBound($aSysProductInfo) + 1][7]
$aSysProductInfo[$i][0] = $objItem.Name
$aSysProductInfo[$i][1] = $objItem.IdentifyingNumber
$aSysProductInfo[$i][2] = $objItem.SKUNumber
$aSysProductInfo[$i][3] = $objItem.UUID
$aSysProductInfo[$i][4] = $objItem.Description
$aSysProductInfo[$i][5] = $objItem.Vendor
$aSysProductInfo[$i][6] = $objItem.Version
$i += 1
Next
$aSysProductInfo[0][0] = UBound($aSysProductInfo) - 1
If $aSysProductInfo[0][0] < 1 Then
SetError(1, 1, 0)
EndIf
Else
SetError(1, 2, 0)
EndIf
EndFunc ;_ComputerGetSystemProduct
|