Custom Inventory can be used to gather recent Windows Events which are stored in Windows Management Interface (WMI). This article presents a sample custom inventory script and custom report that displays the custom inventory data. Please note that Symantec Support does not support custom scripting or reporting so modifications to the script and report must be made by the user.
1 Create a new custom data class that will store the registry information for each computer.
2 Create a Custom Inventory Script Task.
'Create instance of Wbem service object and connect to namespace
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
'Fire WMI Query on Windows Events dataclass
Set objCIMObj = objWMIService.ExecQuery("Select * from Win32_NTLogEvent where eventcode like 6006") '****Your event query here
'Create instance of Altiris NSE component
dim nse
set nse = WScript.CreateObject ("Altiris.AeXNSEvent")
nse.To = "{1592B913-72F3-4C36-91D2-D4EDA21D2F96}" 'Do Not Change this GUID
nse.Priority = 1
dim objDCInstance
set objDCInstance = nse.AddDataClass ("RebootTime") '****Your custom data class name here
dim objDataClass
set objDataClass = nse.AddDataBlock (objDCInstance)
For each objInfo in objCIMObj
'Add a new row
dim objDataRow
set objDataRow = objDataClass.AddRow
'Set columns
objDataRow.SetField 0, objInfo.TimeGenerated
'****If your data class has more than one attribute add a line for each
'objDataRow.SetField 1, objInfo.EventCode
Next
nse.SendQueued
'Uncomment the line below for troubleshooting
'MsgBox nse.Xml
3 Run the Custom Inventory Script task.
4 Create a Custom Report to view the data collected by the custom inventory.
select vc.[Name], idc.Date
from Inv_RebootTime as idc
left join vComputer as vc on vc.Guid = idc._ResourceGuid