VBScript to change users SMTP addresses

Posted on 2010-01-04
Medium Priority
Last Modified: 2012-05-08
Does anyone have a good example of a vbscript that will get all SMTP addresses listed for a user and append a value at the end of each address?

I.e. A user has two email addresses bsmith@domain.com and bsmith@customdomain.com.  The vbscript would look change each address to bsmith_disabled@domain.com and bsmith_Disabled@customdomain.com

Assumption is the 'Automatically update e-mail addresses based on e-mail address policy' is not checked for the user.
Question by:TexasPlowBoy

Expert Comment

ID: 26175910
You could use LDIFDE for the export, edit the SMTP addresses and then use LDIFDE to import the changes back in.  This will export out ALL SMTP addresses;

ldifde -f smtpaddresses.txt -d "dc=domain,dc=com" -l proxyaddresses -r "(proxyaddresses=*)"

But, it sounds like you might be trying to disable SMTP for a select group of users, is that what you are trying to do?   There are ways to do disable Internet email using a security group and some other steps.  If that is your goal, reply back and also with the version of Exchange.  If not, my apologies.

Accepted Solution

mikainz earned 2000 total points
ID: 26181128
see http://www.msexchange.org/articles/Scripting-Exchange-VBScript-ADSI-Part1.html and the following parts 2 and 3 for a whole tutorial.

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Steps to fix “Unable to mount database. (hr=0x80004005, ec=1108)”.
Steps to fix error: “Couldn’t mount the database that you specified. Specified database: HU-DB; Error code: An Active Manager operation fail”
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses
Course of the Month13 days, 12 hours left to enroll

755 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question