VBScript to export SMTP proxy addresses
Part of the way my current employer has grown is through acquisitions and mergers. Consequently we’ve been supporting more than 10 legacy SMTP domains from various shipping lines. Now that we’re decommissioning our systems it’s time to do some housekeeping and discontinue these domains.
The first step was to check that all objects had their primary SMTP address set to the main domain name. This was done more than a year ago but needed to be reconfirmed. A custom LDAP query that included the syntax (!mail=*@our_main_domain.com) sufficed.
Next I wrote a script that exported all SMTP proxy addresses for user objects. This was to be used as a reference in the unlikely event that problems arose down the line. The LDAP query can easily be modified for groups, contacts and public folders. It’s not the most exciting of scripts but it does the job. You can download it here: AllSMTPProxies.vbs.txt
As I wanted to be very specific and meticulous in the removal of legacy proxy addresses I wrote another script that targets a specific SMTP domain. In this script you can specify the domain by changing the strSMTPDomain value. The script will then only export the names and addresses for proxies that match the SMTP domain. You can download the script here: SpecificSMTPProxies.vbs.txt
In my next post I’ll be using PutEx in a script to remove proxy addresses from AD objects.
November 7th, 2006 at 9:49 pm
Is there any way to have this script also export public folder and Distribution list addresses. It worked great for my users, but I also need a report of public folder and DL SMTP addresses…
Thanks
November 8th, 2006 at 8:05 am
November 17th, 2006 at 4:23 pm
I use a script to upload a white list to our spam filter provider. My problem is that I can get all mail addresses and all DL addresses. I cannot get the secondary smtp addresses. Is this possible.
example.
primary = jim.gingrich
James.gingrich is not returned in the query.
Thanks in Advance
January 4th, 2007 at 5:08 am
The current script is looking for = “smtp:”, so the script only pulls the secondary addresses. Primary addresses are formatted in CAPS, so you can force all address to lower-case by using the LCase() function:
For Each Address In arrProxyAddresses
If LCase(left(Address,5))= “smtp:” Then
objTextFile.writeLine(FoundObject.Displayname & vbTab & Address)
That’s it! Nice and simple.
Good Luck
End if
Next
January 19th, 2007 at 6:15 pm
How would you go about modifying the script to connect to a different domain? We run a resource domain model and my machine is not a member of the domain that holds the Exchange Org.
Thanks!
December 5th, 2007 at 9:51 am
The script does not handle users with only one primary SMTP proxy address.
January 15th, 2008 at 12:11 am
When I modify your script to use the group or public folder object class the following is returned when the script executes: “(49, 2) Microsoft VBScript runtime error: Object not a collection”. No output is generated. Any idea what would cause this?
Thanks……………..Eric
January 21st, 2008 at 6:35 am
Hi,
I also recived the folllowinmg error, one txt file is created, but only with 3 to 4 names, the script gave the following error
Line: 49
Char: 2
Error: Obejct not a collection
Code : 800A01c3
Source: Microsoft VBScript runtime error