One of my customer is facing a similar issue, they want to search a file with a particular ext (*.KMT). Full / File Inventory doesn't detect it. Below is the Vb script and Data Class screenshot.
'**********************************************************************************
'Copyright Symantec Corporation - Altiris Business Unit - 2007
'May be used with permission from copyright holder
'Author: Douglas Jenkins
'Created: December 2007
'Modifications:
' 20080108: Modified to process an array of specified paths rather than a single drive
' Removed the ProcessDrive subroutine
' Call ProcesFolders subroutine from main For loop rather than ProcessDrive subroutine
' Modified exclusion logic to use an array and the InStr function
' 20091022 Update for NS7
'**********************************************************************************
'
' END-USER INSTRUCTIONS:
' Please make the following changes as per your requirements in your environment.
' All changes to be made are in the 'User Customization Section'.
' 1. Modify the 'folders2Scan' array to contain the list of desired folders. REQUIRED.
' 2. Modify the 'folders2Exclude' array by adding or removing directories to be excluded. REQUIRED.
' 3. Modify the dataClassName, as desired. This is not required.
' 4. Modify the nsi output path, as desired for testing. This is not required.
' No other modifications should be required
'**********************************************************************************
dim folder, curDrive
'**********************************************************************************
' User Customization Section - Please make changes within this section only
'**********************************************************************************
'Array of folders to scan. ONLY the folders listed in this array will be scanned. Subdirectories of these
' folders can be excluded, below.
' The array is zero-based, so an array of (2) can contain three items.
' THE ARRAY SIZE VALUE MUST MATCH THE NUMBER OF ITEMS IN THE LIST.
' ITEMS IN THE LIST MUST BE NUMBERED SEQUENTIALLY BEGINNING AT 0.
' Root folders do not have a 'size' or 'datelastaccessed' value. If specified, there will be no entry created
' for the root folder. However, all folders within the root of the drive will be processed unless excluded.
Dim folders2Scan(3)
folders2Scan(0) = "c:\test\"
folders2Scan(1) = "C:\test\2SU00.KMT"
folders2Scan(2) = "C:\test\5SU00.KMT"
folders2Scan(3) = "C:\"
'Array of folders to EXCLUDE
' The entry can be a complete path, a complete folder name, a partial path or partial folder name. Be careful.
' Any folder name containing these strings will be excluded. Sub-folders will also be excluded.
' This has priority over the folders2Scan entries.
' This script uses the InStr function. We will look for the following strings in each path scanned.
' This array allows for exclusion of system folders and specific subfolders within a folder to be scanned.
' We recommend preserving the first three exclusion array entries as scanning certain system folders may
' cause the script to abort.
' The array is zero-based, so an array of (2) can contain three items.
' THE ARRAY SIZE VALUE MUST MATCH THE NUMBER OF ITEMS IN THE LIST.
' ITEMS IN THE LIST MUST BE NUMBERED SEQUENTIALLY BEGINNING AT 0.
' These entries are NOT case-sensitive.
Dim folders2Exclude(3)
folders2Exclude(0) = "System Volume Information"
folders2Exclude(1) = "recycler"
folders2Exclude(2) = "msocache"
folders2Exclude(3) = "C:\mystuff\picnix48\source"
'**********************************************************************************
' End of User Customization Section - no other changes should be made
'**********************************************************************************
''' Altiris Stuff
'Create instance of Altiris NSE component
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. Here assumption is that the data class with below guid is already configured on server
dim objDCInstance
set objDCInstance = nse.AddDataClass ("{03ecd975-4923-476d-8161-6815cf30a571}")
dim objDataClass
set objDataClass = nse.AddDataBlock (objDCInstance)
''' End of Altiris Stuff
'process all folders specified in the folders2Scan array and create nsi output
For Each path In folders2Scan
'Wscript.echo "Processing array: Path=" & path
Call ProcessFolders(path)
next
''' Altiris Stuff
' Send the NSE data to the NS server
nse.SendQueued
''' End of Altiris Stuff
''' End of vbscript main logic
'*******************************************************************************************************************
'*** Subroutines *
'*******************************************************************************************************************
Sub ProcessFolders(path)
'Wscript.echo path
'skip excluded folders
validFolder = 1
For Each exFolder in folders2Exclude
exFoundValue = InStr(UCASE(path), UCASE(exFolder))
if exFoundValue <> 0 then validFolder = 0
'Wscript.echo " exFolder=" & exFolder & ": exFoundValue=" & exFoundValue & " and validFolder=" & validFolder
next
'Wscript.echo " "
if validFolder then
Set fs = CreateObject("Scripting.FileSystemObject")
set folder = fs.GetFolder(path)
'Wscript.echo "folder.Path=" & folder.Path
' Root folders do not have size nor datelastaccessed. Don't create a record for them.
if folder.IsRootFolder = false then
''' Altiris Stuff '''
'Add a new row
dim objDataRow
set objDataRow = objDataClass.AddRow
'Set columns
objDataRow.SetField 0, ToXmlString(folder.Name)
objDataRow.SetField 1, ToXmlString(folder.Path)
objDataRow.SetField 2, ToXmlString(folder.Size)
objDataRow.SetField 3, ToXmlString(folder.DateLastAccessed)
''' End of Altiris Stuff '''
end IF
' Recurse through all subfolders
For each item in folder.SubFolders
ProcessFolders(item.Path)
Next
set folder = Nothing
end IF
End Sub
Function ToXmlString (strInput)
Dim strOutput
If (IsNull(strInput)) Then
ToXMLString = strInput
Else
strOutput = Replace(strInput, "&", "&")
strOutput = Replace(strOutput, """", """)
strOutput = Replace(strOutput, "<", "<")
ToXmlString = Replace(strOutput, ">", ">")
End If
End Function