Enabling or Disabling Global Catalog Servers

Microsoft® Windows® 2000 Scripting Guide

As the number of computers in your organization increases or decreases, you might need to enable or disable the global catalog service on domain controllers. For example, if the only global catalog server in a site fails, you can enable a different global catalog server. If a single site has more global catalog servers than it needs (resulting in excessive replication traffic), you can disable the global catalog service on one or more computers.

You can enable and or disable domain controllers as global catalog servers by using ADSI.

Scripting Steps

The scripts for enabling or disabling a global catalog server are very similar.

Enabling a Global Catalog Server

Listing 9.18 contains a script that enables a computer to act as a global catalog server. To carry out this task, the script must perform the following steps:

  1. Use a GetObject call to bind to RootDSE on the domain controller you want to enable as a global catalog server.

  2. Use the Get method to obtain the value of the dsServiceName attribute.

    The dsServiceName attribute represents the distinguished name for the NTDS Settings object for this domain controller.

  3. Use a second GetObject call to connect to the NTDS Settings object.

    The NTDS settings represent the data in the Active Directory that define a computer as a domain controller.

  4. Set the value of the Options attribute to 1.

    The Options attribute represents different things depending on the object. For the NTDS Settings object, the Options attribute indicates whether the computer has been enabled as a global catalog server.

  5. Use the SetInfo method to apply the changes to Active Directory.

Listing 9.18 Enabling a Global Catalog Server

  
1
2
3
4
5
6
7
On Error Resume Next
Set objRoot = GetObject("LDAP://atl-dc-01/RootDSE")
objDSServiceDN = objRoot.Get("dsServiceName")
Set objDSRoot = GetObject("LDAP://atl-dc-01/" & objDSServiceDN )
blnCurrentOptions = objDSRoot.Get("Options")
objDSRoot.Put "options" , 1
objDSRoot.Setinfo

Disabling a Global Catalog Server

To disable a global catalog server, use the same code as shown in Listing 9.18, but set the value of the Options attribute to 0, as shown in Listing 9.19.

Listing 9.19 Disabling a Global Catalog Server

  
1
2
3
4
5
6
7
On Error Resume Next
Set objRoot = GetObject("LDAP://atl-dc-01/RootDSE")
objDSServiceDN = objRoot.Get("dsServiceName")
Set objDSRoot = GetObject("LDAP://atl-dc-01/" & objDSServiceDN )
blnCurrentOptions = objDSRoot.Get("Options")
objDSRoot.Put "options" , 0
objDSRoot.Setinfo