Saturday, July 11, 2009

KiXtart: Get Asset Number

WMI query for asset number (e.g. Dell Asset, HP Serial number, etc.)


Function AssetNumber()
Dim $objWmi, $objWmiCS, $obj, $retval, $pc
$pc = @wksta
$objWmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\$pc\root\cimv2")
$objWmiCS = $objWmi.ExecQuery("select * from Win32_ComputerSystemProduct")
For Each $obj in $objWmiCS
$retval = $obj.IdentifyingNumber
Next
$AssetNumber = Trim($retval)
EndFunction

No comments:

Post a Comment