const HKEY_LOCAL_MACHINE = &H80000002 const REG_SZ = 1 const REG_EXPAND_SZ = 2 const REG_BINARY = 3 const REG_DWORD = 4 const REG_MULTI_SZ = 7 strComputer = "." int intMaxNameLen = 0 'Set StdOut = WScript.StdOut ' Create Array of Database Field Names. ' This is *MUST* be in the same order as the custom Inventory table in Altiris arrDB_Fields = Array(_ "AMTConfigurationMode",_ "AMTConfigurationState",_ "AMTControlMode",_ "AMTFQDN",_ "AMTSKU",_ "AMTState",_ "AMTversion",_ "FWVersion",_ "IsAMTConfigured",_ "IsAMTEACEnabled",_ "IsAMTEnabledInBIOS",_ "IsAMTFWUpdateEnabled",_ "IsAMTIDEREnabled",_ "IsAMTKVMEnabled",_ "IsAMTKVMSupported",_ "IsAMTSOLEnabled",_ "IsAMTSupported",_ "IsAMTWebUIEnabled",_ "IsAntiTheftSupported",_ "IsCCMSupported",_ "IsCILASupported",_ "IsHBPSupported",_ "IsHWCryptoEnabled",_ "IsIDEREnabledInBIOS",_ "IsIDERSupportedInBIOS",_ "IsKVMEnabledInBIOS",_ "IsKVMSupportedInBIOS",_ "IsMEIEnabled",_ "IsNetworkInterfaceEnabled",_ "IsSOLEnabledInBIOS",_ "IsSOLSupportedInBIOS",_ "IsTLSEnabled",_ "IsTLSSupported",_ "IsZTCEnabled",_ "MEIVersion",_ "MEPlatformSKUs",_ "PskPID",_ "UUID",_ "WiredIPv4IP",_ "WiredLinkStatus",_ "WiredMACAddress",_ "WirelessIPv4IP",_ "WirelessLinkStatus",_ "WirelessMACAddress",_ "BIOSVersion",_ "Chassis",_ "Manufacturer",_ "Model",_ "OperatingSystem",_ "OSDHCP",_ "OSDHCPEnabled",_ "OSDNS",_ "OSDNSHostName",_ "OSDomainName",_ "OSGateway",_ "OSHostName",_ "OSIP",_ "OSPrimaryDNSSuffix",_ "OSSubnet",_ "SerialNumber",_ "SMBIOSAssetTagData",_ "LastTimeUpdated",_ "LMSVersion",_ "PingConfigurationServer",_ "UNSVersion") ' Items excluded from current inventory ' "CertificateHashes",_ ' debug (output array indecies and field names) 'for i = 0 to ubound(arrDB_Fields) ' wscript.echo i & ": " & arrDB_Fields(i) 'next 'Get data from the registry - enum all values in key and convert to String Values Set oReg = GetObject("winmgmts:{impersonationLevel = impersonate}!\\"& strComputer & "\root\default:StdRegProv") KeyPath = "Software\Intel\SCS7.0\System_Discovery" oReg.EnumValues HKEY_LOCAL_MACHINE,KeyPath,arrRegValueNames,arrRegValueTypes ReDim arrRegValues(UBound(arrRegValueNames)) For i=0 To UBound(arrRegValueNames) Select Case arrRegValueTypes(i) Case REG_SZ oReg.GetStringValue HKEY_LOCAL_MACHINE,KeyPath,arrRegValueNames(i),strValue strDataType = "String" Case REG_EXPAND_SZ oReg.GetExpandedStringValue HKEY_LOCAL_MACHINE,KeyPath,arrRegValueNames(i),strValue strDataType = "Expanded String" Case REG_BINARY oReg.GetBinaryValue HKEY_LOCAL_MACHINE,KeyPath,arrRegValueNames(i),binary strValue = "" For j = lbound(binary) to ubound(binary) strValue = strValue + Right("0"+ Hex(binary(j)),2) Next strDataType = "Binary" Case REG_DWORD oReg.GetDWORDValue HKEY_LOCAL_MACHINE,KeyPath,arrRegValueNames(i),dwValue strValue = Cstr(dwvalue) strDataType = "DWORD" Case REG_MULTI_SZ oReg.GetMultiStringValue HKEY_LOCAL_MACHINE,KeyPath,arrRegValueNames(i),arrRegValues strValue = "" For j = lbound(arrRegValues) to ubound(arrRegValues) strValue = strValue & arrRegValues(j) & vbCRLF Next strDataType = "Multi String" End Select ' Debug output ' wscript.echo "I: " & i & vbCRLF & "VarType: " & vartype(strvalue) & vbCRLF & "lbound: " & lbound(arrRegValueNames) & vbCRLF & "ubound: " & ubound(arrRegValueNames) & vbCRLF &_ ' "Value Name: " & arrRegValueNames(i) & vbCRLF & "Data Type: " & StrDataType & vbCRLF & "Value: " & strValue & vbCRLF ' Wscript.echo Right(Space(7) & "[" & Len(arrRegValues(i)) & "] ",11) & right("00" & i,2) & " " & arrRegValueNames(i) & " " & space(intMaxNameLen - len(arrRegValueNames(i))) & arrRegValues(i) arrRegValues(i) = StrValue intMaxNameLen = max(intMaxNameLen, Len(arrRegValueNames(i))) Next ''Create instance of Altiris NSE component and set the header data of the NSE dim nse set nse = WScript.CreateObject ("Altiris.AeXNSEvent") '' Please don't modify this GUID. This is the 'Inventory Capture Item'. nse.To = "{1592B913-72F3-4C36-91D2-D4EDA21D2F96}" nse.Priority = 1 'Create Inventory data block - custom inventory instance, dataclass and associated row(s) of data. 'CHANGE the following guid. This is the guid of associated custom inventory dataclass. 'The data class name or its guid must be used here. In this example, a guid is commented out. dim objDCInstance ''set objDCInstance = nse.AddDataClass ("{941c9eed-55c5-41d1-a3d9-bcaf7e548c56}") set objDCInstance = nse.AddDataClass ("ACU_Discovery_Data") dim ObjDataClass Set ObjDataClass = nse.AddDataBlock (objDCInstance) dim objDataRow set objDataRow = objDataClass.AddRow ' Populate the data block with data Wscript.echo "Loading Inventory Data:" for i = 0 to UBound(arrDB_Fields) ' find the db fieldname in the array of Reg Valuenames intIndex = GetArrayIndex(arrDB_Fields(i), arrRegValueNames) if intIndex >= 0 then objDataRow.SetField i, arrRegValues(intIndex) Wscript.echo space(3) & right("00" & i,2) & " " & arrRegValueNames(intIndex) & " " & space(intMaxNameLen - len(arrRegValueNames(intIndex))) & arrRegValues(intIndex) ' More detailed output for debug below (includes variable size and actual position in the RegValue array) ' Wscript.echo Right(Space(7) & "[s:" & Len(arrRegValues(intIndex)) & "] ",12) & "[p:" & right("00" & intIndex & "] ",5) & right("00" & i,2) & " " & arrRegValueNames(intIndex) & " " & space(intMaxNameLen - len(arrRegValueNames(intIndex))) & arrRegValues(intIndex) else objDataRow.SetField i, "" Wscript.echo " * " & right("00" & i,2) & " " & arrDB_Fields(i) & " " & space(intMaxNameLen - len(arrDB_Fields(i))) & "NOT FOUND IN REGISTRY KEY! Assigning Null ***" end if next ' Send the data to Altiris.... Wscript.echo vbCRLF & "Sending to Notification Server..." nse.SendQueued Wscript.echo "Complete." ' supporting functions Function Max(a, b) If a > b Then Max = a Else Max = b End Function ' Search for the DBField name in the list of reg name enums. Return the position if found Function GetArrayIndex(strSearchString, arrArrayToSearch) GetArrayIndex = -1 for x = 0 to UBound(arrArrayToSearch) if ucase(arrArrayToSearch(x)) = ucase(strSearchString) and strSearchString <> "" then ' wscript.echo "Found [" & right(" " & x & "] ", 4) & strSearchString GetArrayIndex = x exit for end if next ' if GetArrayIndex < 0 then wscript.echo "Not Found: " & strSearchString End Function