' This script was originally published in the Exchange Cookbook, ' (http://www.exchangebookcook.com). Written by Paul Robichaux, ' Missy Koslosky, and Devin Ganger. Redistributed with permission ' of the publisher, O'Reilly & Associates. ' This code removes all existing instances of the Exchange_DSAccessDC object. ' Doing so forces Exchange to re-run the topology discovery process. ' ------ SCRIPT CONFIGURATION ------ strServer = "batman" '' "" ' e.g. xch01.foobar.com strDC = "batman" '' "" ' e.g. dc01.foobar.com configType = 0 ' 0 = manual; 1 = automatic ' ------ END CONFIGURATION --------- ' Get the Exchange Namespace WMI object Set objWMIExch = GetObject("winmgmts:{impersonationLevel=impersonate}!//" &_ strServer & "/root/MicrosoftExchangeV2") ' Get the list of Exchange_DSAccessDC instances and iterate through them ' to modify their properties; all instances of this Type will become manually ' configured. Set listDCInst = objWMIExch.InstancesOf("Exchange_DSAccessDC") For each objDCInst in listDCInst objDCInst.Type = configType objDCInst.Put_ Next ' Delete all manually configured instances of one Type so that the discovery ' state is reset to Automatic and triggers topology discovery For each objDCInst in listDCInst If (objDCInst.ConfigurationType = configType) Then wScript.echo " **Deleting manually configured DC." objDCInst.Delete_ End if Next