I'm working on trying to gather reporting data to see which of our machines are vulnerable to the recent Intel Vulnerability.
I haven't done much with custom inventory, but I did create the class with the columns I want to collect based on the registry output from the Intel Vuln scanner.
Anyone have an example of a script I could use to gather multiple registry keys into the new custom data class (some are in different subkeys if that matters)?
I am trying to follow this example & starting with just one registry key to start (before tackling how to get multiple keys).
I'm uncommenting out MsgBox nse.Xml for troubleshooting, but I keep getting error about invalid type for data field on the "objDataRow.SetField 0, ComputerModel" line.
I'm sure I'm missing something obvious.
'Pick the appropriate WMI registry hive code and comment the line you don’t use
Const HKEY_LOCAL_MACHINE = &H80000002'Another example: Const HKEY_LOCAL_MACHINE = &H80000002
Set wshShell = WScript.CreateObject( "WScript.Shell" )
ComputerName = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
set nse = WScript.CreateObject ("Altiris.AeXNSEvent")
nse.To = "{1592B913-72F3-4C36-91D2-D4EDA21D2F96}"'Do not modify this GUID
nse.Priority = 1
dim objDCInstance
set objDCInstance = nse.AddDataClass ("IntelSA00086") 'Your Data Class Here
set objDataClass = nse.AddDataBlock (objDCInstance)
KeyPath = "SOFTWARE\Intel\Setup and Configuration Software\INTEL-SA-00086 Discovery Tool\Hardware Inventory"'Your Registry Key Path Here
ValueName = "Computer Model"'Your Registy Entry Here
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")'Use the HKEY constant defined earlier and use the oReg function appropriate to the type of data in the registry entry
error_returned = oReg.GetStringValue(HKEY_LOCAL_MACHINE,KeyPath,ValueName,Value)
'Another example: error_returned = oReg.GetStringValue(HKEY_LOCAL_MACHINE,KeyPath,ValueName,Value)
if error_returned <> 0 then Value = "Does Not Exist" end if
set objDataRow = objDataClass.AddRow
objDataRow.SetField 0, ComputerModel
'objDataRow.SetField 1, MEVersion'objDataRow.SetField 2, SystemRisk'If your data class has more than one attribute add a line for each'objDataRow.SetField 1, Value2'nse.Send'Uncomment the line below for testing purposes
MsgBox nse.Xml