Previous in Contents Next in Contents

Accessing an ISearchServer Interface Object

You access an ISearchServer interface object by calling the SearchAdmin.SearchServer property, as in the following example, where objSearchServer is the name you give to the new ISearchServer interface object:

Option Explicit 
On Error Resume Next

Dim objSearchAdmin, objSearchServer, objSA

Set objSearchAdmin  = CreateObject("Search.SearchAdmin.1")
Set objSearchServer = objSearchAdmin.SearchServer

' Just for grins let's make sure the SearchAdmin property 
' really returns the same reference.

Set objSA           = objSearchServer.SearchAdmin

if NOT objSearchAdmin is objSA then
  Wscript.Echo "The SearchAdmin property is bogus. See ya!"
  Wscript.Quit
else
  Wscript.Echo "The SearchAdmin property points to the parent."
end if

Wscript.Echo "There are " & objSearchServer.SearchCatalogs.Count _
  & " catalogs stored at " & objSearchServer.CatalogsLocation

If NOT objSearchServer.DefaultCatalog = "" Then
  Wscript.Echo "The default Search catalog is " _
    & objSearchServer.DefaultCatalog 
End If

Select Case objSearchServer.PerformanceLevel
  Case 1
    Wscript.Echo "Search runs in the background" 
  Case 2
    Wscript.Echo "Search runs at a low priority" 
  Case 3
    Wscript.Echo "Search runs at a medium priority" 
  Case 4
    Wscript.Echo "Search runs at a high priority" 
  Case 5 
    Wscript.Echo "Host resources are dedicated to Search" 
End Select

'Release objects 
Set objSearchServer = Nothing 
Set objSearchAdmin  = Nothing 
Set objSA           = Nothing 
 

© 1997-2000 Microsoft Corporation. All rights reserved.