ActiveXperts Network Monitor
Monitor servers, workstations, devices and applications in your network

Quicklinks


Indexing Service Scripts

Configuring the Indexing Service to Autostart
Create an Indexing Service Catalog
Create an Indexing Service Scope
Delete an Indexing Service Catalog
Delete an Indexing Service Scope
List Indexing Service Catalogs
List Indexing Service Scopes
List Specific Files Included in the Indexing Service
List the State of the Indexing Service
Monitor Indexing Service Filter Performance
Monitor Indexing Service Performance
Pause the Indexing Service
Resume the Indexing Service
Search for Files Using the Indexing Service
Search Indexing Server Using a Predefined Query
Search the Indexing Service Using a Free Text Search
Start the Indexing Service
Stop the Indexing Service


You can use any of the VBScript programs below in ActiveXperts Network Monitor. Click here for an explanation about how to include scripts in ActiveXperts Network Monitor.



Configuring the Indexing Service to Autostart


Configures the Indexing Service on the local computer to automatically start each time the computer starts. To configure the Indexing Service for manual start, set the parameter passed to the EnableCI method to False rather than True. Manual start is the default setting for the Indexing Service.
On Error Resume Next

Set objAdminIS = CreateObject("Microsoft.ISAdm")
objAdminIS.EnableCI(True)
	

Create an Indexing Service Catalog


Adds an Indexing Service catalog named Script Catalog (with a catalog location of C:\Scripts) to the local computer.
On Error Resume Next

Set objAdminIS = CreateObject("Microsoft.ISAdm")
objAdminIS.Stop()

Set objCatalog = objAdminIS.AddCatalog("Script Catalog","c:\scripts")
objAdminIS.Start()
	

Create an Indexing Service Scope


Adds a scope named Script Scope (with the path C:\Scripts) to an Indexing Service catalog named Script Catalog on the local computer.
On Error Resume Next

Set objAdminIS = CreateObject("Microsoft.ISAdm")
Set objCatalog = objAdminIS.GetCatalogByName("Script Catalog")
Set objScope = objCatalog.AddScope("c:\scripts\Indexing Server", False)
objScope.Alias = "Script scope"
objScope.Path = "c:\scripts"
	

Delete an Indexing Service Catalog


Removes an Indexing Service catalog named Script Catalog from the local computer.
On Error Resume Next

Set objAdminIS = CreateObject("Microsoft.ISAdm")
objAdminIS.Stop()
errResult = objAdminIS.RemoveCatalog("Script Catalog", True)
objAdminIS.Start()
	

Delete an Indexing Service Scope


Removes the Indexing Service scope C:\Scripts from the Indexing Service catalog named Script Catalog.
On Error Resume Next

Set objAdminIS = CreateObject("Microsoft.ISAdm")
Set objCatalog = objAdminIS.GetCatalogByName("Script Catalog")
objCatalog.RemoveScope("c:\scripts")
	

List Indexing Service Catalogs


Returns information about all the Indexing Service catalogs available on the local computer.
On Error Resume Next

Set objAdminIS = CreateObject("Microsoft.ISAdm")
objCatalog = objAdminIS.FindFirstCatalog()
If (objCatalog) Then
    Set objCatAdm = objAdminIS.GetCatalog()
    Wscript.Echo "Catalog location: " & objCatAdm.CatalogLocation
    Wscript.Echo "Catalog name: " & objCatAdm.CatalogName
    If (objAdminIS.IsRunning) Then 
        Wscript.Echo "Is stopped: " & objCatAdm.IsCatalogStopped
        Wscript.Echo "Is paused: " & objCatAdm.IsCatalogPaused
        Wscript.Echo "Is running: " & objCatAdm.IsCatalogRunning
        Wscript.Echo "Delayed filter count: " & objCatAdm.DelayedFilterCount
        Wscript.Echo "Documents to filter: " & objCatAdm.DocumentsToFilter
        Wscript.Echo "Filtered document count: " & _
            objCatAdm.FilteredDocumentCount
        Wscript.Echo "Fresh test count: " & objCatAdm.FreshTestCount
        Wscript.Echo "Index size: " & objCatAdm.IndexSize
        Wscript.Echo "Percent merge complete: " & objCatAdm.PctMergeComplete
        Wscript.Echo "Pending scan count: " & objCatAdm.PendingScanCount
        Wscript.Echo "Persistent index count: " & _
            objCatAdm.PersistentIndexCount
        Wscript.Echo "Query count: " & objCatAdm.QueryCount
        Wscript.Echo "State info: " & objCatAdm.StateInfo
        Wscript.Echo "Total document count: " & objCatAdm.TotalDocumentCount
        Wscript.Echo "Unique key count: " & objCatAdm.UniqueKeyCount
        Wscript.Echo "Word list count: " & objCatAdm.WordListCount
    End If 
End If
 
Do
    objCatalog = objAdminIS.FindNextCatalog()
    If (objCatalog) Then
        Set objCatAdm = objAdminIS.GetCatalog()
        Wscript.Echo "Catalog location: " & objCatAdm.CatalogLocation
        Wscript.Echo "Catalog name: " & objCatAdm.CatalogName
    If (objAdminIS.IsRunning) Then 
        Wscript.Echo "Is stopped: " & objCatAdm.IsCatalogStopped
        Wscript.Echo "Is paused: " & objCatAdm.IsCatalogPaused
        Wscript.Echo "Is running: " & objCatAdm.IsCatalogRunning
        Wscript.Echo "Delayed filter count: " & objCatAdm.DelayedFilterCount
        Wscript.Echo "Documents to filter: " & objCatAdm.DocumentsToFilter
        Wscript.Echo "Filtered document count: " & _
            objCatAdm.FilteredDocumentCount
        Wscript.Echo "Fresh test count: " & objCatAdm.FreshTestCount
        Wscript.Echo "Index size: " & objCatAdm.IndexSize
        Wscript.Echo "Percent merge complete: " & objCatAdm.PctMergeComplete
        Wscript.Echo "Pending scan count: " & objCatAdm.PendingScanCount
        Wscript.Echo "Persistent index count: " & _
            objCatAdm.PersistentIndexCount
        Wscript.Echo "Query count: " & objCatAdm.QueryCount
        Wscript.Echo "State info: " & objCatAdm.StateInfo
        Wscript.Echo "Total document count: " & objCatAdm.TotalDocumentCount
        Wscript.Echo "Unique key count: " & objCatAdm.UniqueKeyCount
        Wscript.Echo "Word list count: " & objCatAdm.WordListCount
        End If 
    Else
        Exit Do
   End If
Loop
	

List Indexing Service Scopes


Returns information about all the Indexing Service scopes found on the local computer.
On Error Resume Next

Set objAdminIS = CreateObject("Microsoft.ISAdm")
objCatalog = objAdminIS.FindFirstCatalog()
If (objCatalog) Then
    Set objCatAdm = objAdminIS.GetCatalog()
    Set objScopeAdm = objCatAdm.GetScope()
    Wscript.Echo "Alias: " & objScopeAdm.Alias
    Wscript.Echo "Exclude scope: " & objScopeAdm.ExcludeScope
    Wscript.Echo "Logon: " & objScopeAdm.Logon
    Wscript.Echo "Path: " & objScopeAdm.Path
    Wscript.Echo "Virtual scope: " & objScopeAdm.VirtualScope
End If
 
Do
    objCatalog = objAdminIS.FindNextCatalog()
    If (objCatalog) Then
        Set objCatAdm = objAdminIS.GetCatalog()
        Set objScopeAdm = objCatAdm.GetScope()
        Wscript.Echo "Alias: " & objScopeAdm.Alias
        Wscript.Echo "Exclude scope: " & objScopeAdm.ExcludeScope
        Wscript.Echo "Logon: " & objScopeAdm.Logon
        Wscript.Echo "Path: " & objScopeAdm.Path
        Wscript.Echo "Virtual scope: " & objScopeAdm.VirtualScope
    Else
        Exit Do
    End If
Loop
	

List Specific Files Included in the Indexing Service


Returns a list of all the files included in the Indexing Service catalog named Script Catalog.
On Error Resume Next

Set objConnection = CreateObject("ADODB.Connection")
objConnection.ConnectionString = "provider=msidxs;"
objConnection.Properties("Data Source") = "Script Catalog"
objConnection.Open
 
Set objCommand = CreateObject("ADODB.Command")
 
strQuery = "Select Filename from Scope()"
 
Set objRecordSet = objConnection.Execute(strQuery)
 
Do While Not objRecordSet.EOF
    Wscript.Echo objRecordSet("Filename")
    objRecordSet.MoveNext
Loop
	

List the State of the Indexing Service


Returns information about the current state of the Indexing Service on the local computer.
On Error Resume Next

Set objAdminIS = CreateObject("Microsoft.ISAdm")
Wscript.Echo "Is running: " & objAdminIS.IsRunning
Wscript.Echo "Is paused: " & objAdminIS.IsPaused
Wscript.Echo "Computer name: " & objAdminIS.MachineName
	

Monitor Indexing Service Filter Performance


Uses cooked performance counters to return information about Indexing Service filter performance.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

set objRefresher = CreateObject("WbemScripting.SWbemRefresher")
Set colItems = objRefresher.AddEnum(objWMIService, " & _
    "Win32_PerfFormattedData_ContentFilter_IndexingServiceFilter").objectSet
objRefresher.Refresh

For i = 1 to 5
    For Each objItem in colItems
        Wscript.Echo "Binding Time in Milliseconds: " & _
            objItem.Bindingtimemsec
        Wscript.Echo "Caption: " & objItem.Caption
        Wscript.Echo "Description: " & objItem.Description
        Wscript.Echo "Indexing Speed, Megabytes Per Hour: " & _
            objItem.IndexingspeedMBPerhr
        Wscript.Echo "Name: " & objItem.Name
        Wscript.Echo "Total Indexing Speed, Megabytes Per Hour: " & _
            objItem.TotalindexingspeedMBPerhr
        Wscript.Sleep 2000
        objRefresher.Refresh
    Next
Next
	

Monitor Indexing Service Performance


Uses cooked performance counters to return information about Indexing Service content index performance.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

set objRefresher = CreateObject("WbemScripting.SWbemRefresher")
Set colItems = objRefresher.AddEnum(objWMIService," & _
    "Win32_PerfFormattedData_ContentIndex_IndexingService").objectSet
objRefresher.Refresh

For i = 1 to 5
    For Each objItem in colItems
        Wscript.Echo "Caption: " & objItem.Caption
        Wscript.Echo "Deferred for Indexing: " & objItem.Deferredforindexing
        Wscript.Echo "Description: " & objItem.Description
        Wscript.Echo "Files to be Indexed: " & objItem.Filestobeindexed
        Wscript.Echo "Index Size in Megabytes: " & objItem.IndexsizeMB
        Wscript.Echo "Merge Progress: " & objItem.Mergeprogress
        Wscript.Echo "Name: " & objItem.Name
        Wscript.Echo "Number of Documents Indexed: " & _
            objItem.Numberdocumentsindexed
        Wscript.Echo "Running Queries: " & objItem.Runningqueries
        Wscript.Echo "Saved Indexes: " & objItem.Savedindexes
        Wscript.Echo "Total Number of Documents: " & _
            objItem.TotalNumberdocuments
        Wscript.Echo "Total Number of Queries: " & objItem.TotalNumberofqueries
        Wscript.Echo "Unique Keys: " & objItem.Uniquekeys
        Wscript.Echo "Word Lists: " & objItem.Wordlists
        Wscript.Sleep 2000
        objRefresher.Refresh
    Next
Next
	

Pause the Indexing Service


Pauses the Indexing Service on the local computer.
On Error Resume Next

Set objAdminIS = CreateObject("Microsoft.ISAdm")
objAdminIS.Pause()
	

Resume the Indexing Service


Resumes the Indexing Service on the local computer.
On Error Resume Next

Set objAdminIS = CreateObject("Microsoft.ISAdm")
objAdminIS.Continue()
	

Search for Files Using the Indexing Service


Returns the file name and file size for all files (recorded in the Script Catalog Indexing Service catalog) that contain the term Win32_NetworkAdapterConfiguration.
On Error Resume Next

Set objConnection = CreateObject("ADODB.Connection")
objConnection.ConnectionString = "provider=msidxs;"
objConnection.Properties("Data Source") = "Script Catalog"
objConnection.Open
 
Set objCommand = CreateObject("ADODB.Command")
 
strQuery = "Select Filename, Size, Contents from Scope() Where " _
    & "Contains('Win32_NetworkAdapterConfiguration')"
 
Set objRecordSet = objConnection.Execute(strQuery)
 
Do While Not objRecordSet.EOF
    Wscript.Echo objRecordSet("Filename"), objRecordSet("Size")
    objRecordSet.MoveNext
Loop
	

Search Indexing Server Using a Predefined Query


Uses the predefined query #AllProps to return the file name, file size, and author of all the files included in the Indexing Service catalog Script Catalog on the local computer.
On Error Resume Next

Set objConnection = CreateObject("ADODB.Connection")
objConnection.ConnectionString = "provider=msidxs;"
objConnection.Properties("Data Source") = "Script Catalog"
objConnection.Open
 
Set objCommand = CreateObject("ADODB.Command")
 
strQuery = "Create View #AllProps as Select * from Scope()"
 
Set objRecordSet = objConnection.Execute("Select * from Extended_FileInfo")
 
Do While Not objRecordSet.EOF
    Wscript.Echo objRecordSet("Filename") & ", " & objRecordSet("Size") & _
        ", " & objRecordSet("DocAuthor")
    objRecordSet.MoveNext
Loop
	

Search the Indexing Service Using a Free Text Search


Uses a free text search to return the file name and file size for all files in the Indexing Service catalog Script Catalog that include the term Win32_NetworkAdapterConfiguration.
On Error Resume Next

Set objConnection = CreateObject("ADODB.Connection")
objConnection.ConnectionString = "provider=msidxs;"
objConnection.Properties("Data Source") = "Script Catalog"
objConnection.Open
 
Set objCommand = CreateObject("ADODB.Command")
 
strQuery = "Select Filename, Size, Contents from Scope() Where " _
    & "Freetext('Win32_NetworkAdapterConfiguration')"
 
Set objRecordSet = objConnection.Execute(strQuery)
 
Do While Not objRecordSet.EOF
    Wscript.Echo objRecordSet("Filename"), objRecordSet("Size")
    objRecordSet.MoveNext
Loop
	

Start the Indexing Service


Starts the Indexing Service on the local computer.
On Error Resume Next

Set objAdminIS = CreateObject("Microsoft.ISAdm")
objAdminIS.Start()
	

Stop the Indexing Service


Stops the Indexing Service on the local computer.
On Error Resume Next

Set objAdminIS = CreateObject("Microsoft.ISAdm")
objAdminIS.Stop()