' 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 script hides the selected object from all address lists
' This code forcibly sets the default reply address for a mailbox
' and then excluding it from recipient policy processing so that
' the RUS doesn't replace the changed reply address.
' ------ SCRIPT CONFIGURATION ------
CONST ADS_PROPERTY_UPDATE = 2
strServerNamestrDCName= "<server>" ' e.g. "BATMAN"
strContainer= ", CN=Users, <ForestRootDN>" ' e.g. "dc=domain, dc=com"
strUser= "<userName>" ' e.g. "Paul Robichaux"
strDefaultAddr= "<defaultSMTPaddr>" ' eg paulr@domain.com
strProxyAddr1= "<additionalSMTPaddr>" ' e.g. paul.robichaux@domain.com
strX400addr="<X400addr>"
'e.g. c=us;a= ;p=First Organization;o=Exchange;s=paulr;
' ------ END CONFIGURATION ---------
' get the target mailbox
Set objMailbox = GetObject("LDAP://" & strServerName strDCName & _
"/CN=" & strUser & strContainer)
objMailbox.Put "mail", strDefaultAddr
objMailbox.PutEx ADS_PROPERTY_UPDATE, "proxyAddresses", Array(_
"SMTP:" & strDefaultAddr, _
"smtp:" & strProxyAddr1, _
"X400:" & strX400Addr)
objMailbox.PutEx ADS_PROPERTY_UPDATE, "msExchPoliciesExcluded", _
Array("{26491CFC-9E50-4857-861B-0CB8DF22B5D7}")
objMailbox.SetInfo
WScript.Echo "Reset proxy addresses on " & strDefaultAddr
|