You access an ISearchCatalogs interface object by calling the ISearchServer.SearchCatalogs property, as in the following example, where objSearchCatalogs is the name you give to the ISearchCatalogs interface object:
Option Explicit
On Error Resume Next
Dim objSearchAdmin, objSearchCatalogs, objSearchCatalog, NumCatalogs
Set objSearchAdmin = CreateObject("Search.SearchAdmin.1")
Set objSearchCatalogs = objSearchAdmin.SearchServer.SearchCatalogs
' Create a new catalog
Wscript.Echo "Adding TestCatalog."
objSearchCatalogs.Add("TestCatalog")
Wscript.Echo "The search catalogs are:"
For Each objSearchCatalog in objSearchAdmin.SearchServer.SearchCatalogs
Wscript.Echo " " & objSearchCatalog.Name
Next
Wscript.Echo ""
'Get a reference to the TestCatalog catalog
'(just to illustrate using the Item property):
Set objSearchCatalog = objSearchCatalogs.Item("TestCatalog")
Wscript.Echo "The new catalog is " & objSearchCatalog.Name
Wscript.Echo ""
'Now delete the catalog and relist the existing catalogs
Wscript.Echo "Removing TestCatalog."
objSearchCatalogs.Remove("TestCatalog")
if objSearchCatalogs.Count > 0 then
Wscript.Echo "The search catalogs are:"
For Each objSearchCatalog in objSearchCatalogs
Wscript.Echo " " & objSearchCatalog.Name
Next
end if
'Release objects
Set objSearchCatalog = Nothing
Set objSearchCatalogs = Nothing
Set objSearchAdmin = Nothing