Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Standardizing emails in AD

Status
Not open for further replies.

electro93

MIS
Mar 29, 2004
5
US
Hello,

First off thanks for all the help I have received thus far. Hats off to the group. Now on with my question.. I am a consultant at a client and I am pondering this idea. They have 1200 users and need to standardize their email addresses because some users have FirstN@domain.com and FLast@domain.com. I would like to write a script that adds additional emails to their AD object and make the new one the primary reponse. I've been reading on exchange and I haven't found anything other than completely changing the primary email address. Can anyone help shed light on this dilemma? Thanks a bunch!!!

 
buy a book on scripting ADSI, i have one, its fantastic and has loads of ace examples concerning manipulation exchange and mailboxes etc
 
mrmovie, thanks for sharing.
Can you please give the members the references of this fantastic book ?
 
did i forget to mention that i am the author!!!

"adsi scripting for system administrators"
isbn 1-57870-219-4

it has an excellent section on Managing Microsoft Exchange Mailboxes using adsi's ldap provider
 
i will take my tongue out of my cheek, im not really the author.

theres an AD schema snap in mmc which gives a list of all the attributes of objects, i guess you would want to look though this, or the quiv for exchange and find the attribute you want to change\read, bind to the object and change it,,,sounds easy doesnt it!! ;-)
 
I wrote this a while back to muck around with proxyaddresses. You should be able to modify it to meet your need.

' Quick and dirty script to remove the default primary smtp address,set a new, and put the old one back as a
' secondary for each member of a nested group
' Author - fullbrij@comcast.net
' Creation date - 2/12/2004
'
'
' --------------------------------------------- SCRIPT CONFIGURATION --------------------------------------------------
'
'
' strGroupDN is the DN of the group you wish to apply the changes to. You can copy and paste the DN from ADSIEDIT
' strDefaultSuffix is the suffix suffix stamped by the recipient policy for the domain the group is in
' strNewSuffix is the custom suffix you wish to replace the default suffix with for strGroupDN
'
' If you need anything more complex than mailnickname as the prefix then you must modify the script
'
' You will need to create a recipient policy for strNewSuffix with a blank filter so Exchange will accept for delivery
'
strGroupDN = "CN=Test Group,OU=Information Technology,OU=Users,OU=Corporate Office,DC=child,DC=mycompany,DC=com"
strDefaultSuffix = "@permutation1.com"
strNewSuffix = "@permutation2.com"
'
'
' ----------------------------------------------- END CONFIGURATION ---------------------------------------------------
'
'
' create the dictionary and start stamping
set dicSeenGroupMember = CreateObject("Scripting.Dictionary")
StampMembers "LDAP://" & strGroupDN, dicSeenGroupMember
'
Function StampMembers (strGroupADsPath, dicSeenGroupMember)
'
set objGroup = GetObject(strGroupADsPath)
'
for each objMember In objGroup.Members
'
' if the member is a user then stamp it
if objMember.Class = "user" then
' If the smtp address was already there as a secondary smtp address then delete it
objMember.PutEx 4, "ProxyAddresses", Array("smtp:" & objMember.mailnickname & strNewSuffix)
objMember.SetInfo
' put the smtp address in as a primary then set mail and msexchpoliciesexcluded
objMember.PutEx 3, "ProxyAddresses", Array("SMTP:" & objMember.mailnickname & strNewSuffix)
objMember.Put "mail", objMember.mailnickname & strNewSuffix
objMember.Put "msexchpoliciesexcluded", "{26491CFC-9E50-4857-861B-0CB8DF22B5D7}"
objMember.SetInfo
' delete the old primary
objMember.PutEx 4, "ProxyAddresses", Array("SMTP:" & objMember.mailnickname & strDefaultSuffix)
objMember.SetInfo
' add the old primary back as a secondary
objMember.PutEx 3, "ProxyAddresses", Array("smtp:" & objMember.mailnickname & strDefaultSuffix)
objMember.setinfo
end if
'
' if it is a group then expand the group recursively
if objMember.Class = "group" then
'
if dicSeenGroupMember.Exists(objMember.ADsPath) then
' do nothing to avoid looping if we already stamped it
else
' add it to the dictionary and stamp it
dicSeenGroupMember.Add objMember.ADsPath, 1
StampMembers objMember.ADsPath, dicSeenGroupMember
end if
'
end if
'
next
'
End Function
 
xmsre!!! why werent you around last wekk!!! i spent yonks searching for that bloody proxyaddress email thing in AD ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top