Recipe7.8.Removing a Routing Group


Recipe 7.8. Removing a Routing Group

Problem

You need to remove a routing group in your Exchange organization.

Solution

Using a graphical user interface

  1. Open the Exchange System Manager (Exchange System Manager.msc).

  2. Ensure that you have enabled viewing of administrative and routing groups (see Recipe 7.3).

  3. Expand the organization Administrative Groups target administrative group Routing Groups target routing group.

  4. Ensure that all member servers have been moved to other routing groups (see Recipe 7.9).

  5. Select the Routing Groups container. Right-click the routing group object and select Delete.

  6. Confirm the deletion.

Using VBScript
' This code deletes a routing group if it meets several tests ' ------ SCRIPT CONFIGURATION ------ ' Name of the Exchange organization strExchangeOrg = "<Organization>" ' e.g., ExampleOrg ' Name of the administrative group the routing group is in strAdminGroup = "<AdminGroup>" ' e.g., SeattleAG ' Name of the routing group the server is in strRoutingGroup = "<RoutingGroup>" ' e.g., RedmondRG ' Default boolean state; do not change boolReady = True ' ------ END CONFIGURATION --------- ' Create the routing group object strConfigDN = GetObject("LDAP://RootDSE").Get("configurationNamingContext") strRoutingGroupDN = strRoutingGroup & ",CN=Routing Groups,CN=" & _     strAdminGroup & ",CN=Administrative Groups,CN=" & _     strExchangeOrg & ",CN=Microsoft Exchange,CN=Services," & _     strConfigDN Set objRoutingGroup = GetObject("LDAP://CN=" & strRoutingGroupDN) ' Test for member servers still in the RG; set boolean false if found objRoutingGroup.GetInfo numProperties = objRoutingGroup.PropertyCount For PropCount = 0 To (numProperties-1)    Set propEntry = objRoutingGroup.Item(PropCount)    If (propEntry.Name = "msExchRoutingGroupMembersBL") Then       Wscript.Echo "Member servers found in routing group " &_          strRoutingGroup & ";"       Wscript.Echo "  See Recipe 7.10 to move servers to a new RG."       boolReady = False    End If Next ' Test for connectors still in the RG; set boolean false if found strConnectorsDN = "Connections,CN=" & strRoutingGroupDN Set objConnectors = GetObject("LDAP://CN=" & strConnectorsDN) For Each objConnection in objConnectors    Wscript.Echo "Connector found: " & objConnection.Name    boolReady = False Next ' If the boolean is still true, it's safe to delete the RG If boolReady = True Then    objRoutingGroup.DeleteObject(0)    Wscript.Echo "Deleted RG " & strRoutingGroup & "." & VbCrLF Else    Wscript.Echo "RG " & strRoutingGroup & " not deleted." & VbCrLF End If

Discussion

Deleting a routing group is simpler than creating it, although you do need to ensure that you have moved all member servers to other routing groups. You will not be able to move a server from routing group if it hosts any connectors to or from that routing group.

Scripting this task is not documented but is a simple application of basic ADSI scripting methods. There is a caveat: because it uses the DeleteObject(0) method, which recursively deletes the object and any objects it contains, you need to first verify two items of information:

  • You have moved all member servers to other routing groups. Verify this by ensuring that the msExchRoutingGroupMembersBL attribute is not present. If it is present, it will contain a list of the DNs of the servers that are still configured as members of the group. Deleting the routing group will not remove the associated server objects, but they will not be members of a valid routing group until you change their membership (see Recipe 7.10 for how to do this in your scripts).

  • You have removed all connector objects from the routing group. You can see this by checking if the Connectors container within the routing group is empty. If you intend to delete any existing connectors, you do not need to take any special action in your script; they will be deleted when the routing group is deleted.

The scripted solution performs these checks for you to ensure that deleting the routing group object will not cause problems. Since this is a two-part test, we use a simple Boolean variable and set it to False if we fail a test.

Testing for member servers is relatively easy: we merely need to check for the existence of the msExchRoutingGroupMembersBL property on the routing group object. This property is a backlink to the msExchHomeRoutingGroup properties on the server objects. Active Directory maintains the backlinks automatically; when all the servers are moved out of the routing group, the backlink property is removed from the routing group object. We use the GetInfo method to pull the object's attributes into the local cache, then iterate through them with the Item method to check the current attribute's Name property. If we find a match, we have failed the test.

The second test is just as simple, although this time we merely need to check to see if the Connections container in the routing group object is empty or not. We do this with a simple For Each loop; if the loop runs at all, it means we have one or more objects in the container. We print out the names of the objects and set the Boolean variable to False.

See Also

Recipe 7.7 for creating routing groups, Recipe 7.9 for setting the RGM, Recipe 7.10 for moving server between routing groups, Recipe 5.5 Deleting an OU" of Active Directory Cookbook (O'Reilly), and Chapter 5, "Configuring Your Routing Topology," of the Exchange Server 2003 Transport and Routing Guide:

http://www.microsoft.com/technet/prodtechnol/exchange/guides/E2k3TransnRouting/bbc67fb7-a702-4a18-b5ea-e40b0923213b.mspx


Exchange Server Cookbook
Exchange Server Cookbook: For Exchange Server 2003 and Exchange 2000 Server
ISBN: 0596007175
EAN: 2147483647
Year: 2006
Pages: 235

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net