In some situations custom inventory is better than using file inventory for gathering information about a specific file from many different computers. By default file Inventory only detects detailed information for EXE and DLL files and has many exclusion rules built in to limit which folders it scans. It is possible to add inclusion rules to file inventory and to be able to report any desired files, however custom inventory is a far more efficient and reliable method when there is only one desired file with the same name and location on all computers. This article presents a sample custom inventory script and custom report that displays the custom inventory data. See the attachments for examples of more advanced custom inventory scripts. Please note that Broadcom/Symantec Support does not support custom scripting or reporting so modifications to the script and report must be made by the user.
178432 (Introduction to Custom Inventory in Notification Server 8.x [Altiris])
ITMS 8.x
'*******************************************************
'This Custom Inventory vbscript detects a specified file
'*******************************************************
set objFSO = CreateObject("Scripting.FileSystemObject")
'Create the NSE
dim nse
set nse = WScript.CreateObject ("Altiris.AeXNSEvent")
' Set the header data of the NSE. Please don't modify this GUID
nse.To = "{1592B913-72F3-4C36-91D2-D4EDA21D2F96}"
nse.Priority = 1
'Create Inventory data block. The following data class with below guid is already configured on server.
'Brackets are required around the dataclass guid. To get this GUID, click on the custom data class and then the hand (details).
dim objDCInstance
set objDCInstance = nse.AddDataClass ("Custom Data Class") '***your custom data class name here
' or "{GUID of CUSTOM DATA CLASS include brackets}"
dim objDataClass
set objDataClass = nse.AddDataBlock (objDCInstance)
'Add a new row
dim objDataRow
set objDataRow = objDataClass.AddRow
dim fileName
fileName = "c:\Program Files\Altiris\Altiris Agent\Agents\PatchMgmtAgent\AeXPatchUtil.exe" '***full path and name of the file to be detected
if(objFSO.FileExists(fileName)) Then
'If the file exist on the computer, get the details
Set objFile = objFSO.GetFile(fileName)
objDataRow.SetField 0, objFile.Name
objDataRow.SetField 1, objFile.Size
Else
objDataRow.SetField 0, "Not Found"
End If
' Send the NSE data to the NS server
nse.SendQueued
' msgBox nse.XML '***Uncomment this line for testing
select vComputer.Name, Inv_Custom_Data_Class.File, Inv_Custom_Data_Class.Size from Inv_Custom_Data_Class left join vComputer on vComputer.Guid = Inv_Custom_Data_Class._ResourceGuid
178794 Popular Custom Inventory Samples (8.x)