You access an IBuildServer interface object by calling the SearchAdmin.BuildServer property, as in the following example, where objBuildServer is the name you give to the IBuildServer interface object:
Option Explicit
On Error Resume Next
Dim objSearchAdmin, objBuildServer, objBuildCatalog, objSite
Set objSearchAdmin = CreateObject("Search.SearchAdmin.1")
Set objBuildServer = objSearchAdmin.BuildServer
Sub DumpBuildServerProps
Select Case objBuildServer.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 " Search runs with all host resources dedicated to Search"
End Select
Wscript.Echo ""
If objBuildServer.BuildCatalogs.Count > 0 then
Wscript.Echo "There are " & objBuildServer.BuildCatalogs.Count _
& " catalogs:"
For Each objBuildCatalog in objBuildServer.BuildCatalogs
Wscript.Echo " " & objBuildCatalog.Name
Next
Wscript.Echo ""
End If
'Build server properties
Wscript.Echo "Connection timeout: " _
& objBuildServer.ConnectTimeout _
& " seconds."
Wscript.Echo "Data timeout: " _
& objBuildServer.DataTimeout _
& " seconds."
Wscript.Echo "Default account name: " _
& objBuildServer.DefaultAccountName
Wscript.Echo "Default access account name: " _
& objBuildServer.DefaultPluginAccountName
Wscript.Echo "Default catalog location: " _
& objBuildServer.DefaultCatalogsLocation
Wscript.Echo "Default logs location: " _
& objBuildServer.DefaultLogsLocation
Wscript.Echo "Temp files stored at: " _
& objBuildServer.TempPath
Wscript.Echo "Email address for logging: " _
& objBuildServer.EmailAddress
Wscript.Echo "User agent: " _
& objBuildServer.UserAgent
Wscript.Echo "Proxy server: " _
& objBuildServer.ProxyAddress
Wscript.Echo "Proxy port: " _
& objBuildServer.ProxyPortNumber
Wscript.Echo "Proxy configuration: " _
& objBuildServer.ProxyUsageSettings
If objBuildServer.ProxyBypassForLocalAddresses Then
Wscript.Echo "The proxy is bypassed for local addresses"
Else
Wscript.Echo "The proxy is not bypassed for local addresses"
End If
Wscript.Echo "Bypass proxy for these addresses: " _
& objBuildServer.ProxyBypassAddressesList
'Check that SearchAdmin property points to the parent object
If NOT objBuildServer.SearchAdmin is objSearchAdmin Then
Wscript.Echo "SearchAdmin property is bogus!"
Wscript.Quit
End If
Wscript.Echo "Hit restrictions on:"
For Each objSite in objBuildServer.Sites
Wscript.Echo " " & objSite.Name
Next
End Sub
'Display current build server properties
DumpBuildServerProps
'Clear any pending error condition
Err.Clear
'Save current settings
Wscript.Echo ""
Wscript.Echo "***** Saving configuration to C:\Cfg\Test.sbc *****"
Wscript.Echo ""
objBuildServer.SaveConfiguration ("C:\Cfg\Test.sbc")
'Modify Proxy settings
objBuildServer.SetProxySettings 0, "Gproxy", 80, 1, "\\MyTest;\\Test2"
'Modify default account
objBuildServer.SetDefaultAccount "SEATTLE\dougs", "mycroft"
'Modify plugin account
objBuildServer.SetDefaultPluginAccount "SEATTLE\dougs", "mycroft"
'After
DumpBuildServerProps
'Restore previous settings
Wscript.Echo ""
Wscript.Echo "***** Loading configuration from C:\Cfg\Test.sbc *****"
Wscript.Echo ""
objBuildServer.LoadConfiguration ("C:\Cfg\Test.sbc")
'Make sure we didn't clobber anything
DumpBuildServerProps
'Release objects
Set objSite = Nothing
Set objBuildCatalog = Nothing
Set objBuildServer = Nothing
Set objSearchAdmin = Nothing