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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting X500 Addresses After PST Migration

Migration

Setting X500 Addresses After PST Migration

by  markdmac  Posted    (Edited  )

markdmac's Enterprise Ready Scripts

If you have migrated from a previous installation of Exchange by exporting and importing PST files, your users will be unable to reply to old internal emails due to a change in the legacyExchangeDN. This issue can be overcome by adding an X500 address to each mail recipient.

The first step to accomplishing this goal is to capture the legacyExchangeDN information from the old server. To get this attribute, launch ADSIEDIT.msc on the old domain controller and open the properties of a user account. Locate the legacyExchangeDN value and copy/paste it to notepad.

The value will look something like this:
/o=ExampleAB/ou=Organizationalunit1/cn=Recipients/cn=[blue]mmaclachlan[/blue]

Remove the username portion (leave the equals sign) and replace the portion of the script in [red]red[/red] with your legacyExchangeDN value.

Execute the script on a domain controller and you are done.

Code:
[green]
'==========================================================================
'
' NAME: FixX500.vbs
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL: http://www.thespidersparlor.com
' DATE  : 7/16/2009
' COPYRIGHT ¬ 2009, All Rights Reserved
' 
' [blue]THIS SCRIPT AND MANY MORE MAY BE FOUND IN
' THE ADMIN SCRIPT PACK FROM THE SPIDER'S PARLOR
' HTTP://WWW.THESPIDERSPARLOR.COM/PRODUCTS[/blue]
'
' COMMENT: Add an X500 address to a user account to ensure user can
'          reply to old mail after being moved to a new Exchange group.
'
'    THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
'    ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
'    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
'    PARTICULAR PURPOSE.
'
'    IN NO EVENT SHALL THE SPIDER'S PARLOR AND/OR ITS RESPECTIVE SUPPLIERS
'    BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
'    DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
'    WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
'    ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
'    OF THIS CODE OR INFORMATION.
'
'==========================================================================
[/green]
On Error Resume Next

Dim qQuery, objConnection, objCommand, objRecordSet
Dim oRootDSE, strDomain, objUser
Const ADS_PROPERTY_APPEND = 3

x500Base = "[red]/o=ExampleAB/ou=Organizationalunit1/cn=Recipients/cn=[/red]"

Set oRootDSE = GetObject("LDAP://rootDSE")
strDomain = oRootDSE.get("defaultNamingContext")
[green]
' other categories = computer, user, printqueue, group[/green]
qQuery = "<LDAP://" & strDomain &">;" & _
        "(objectCategory=person)" & _
       ";sAMAccountName,distinguishedName;subtree"
[green]
'Perform our query of AD for user objects[/green]
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Open "Provider=ADsDSOObject;"
objCommand.ActiveConnection = objConnection
objCommand.CommandText = qQuery
Set objRecordSet = objCommand.Execute

While Not objRecordSet.EOF[green]
    'Bind to the user object[/green]
    Set objUser = GetObject("LDAP://" & objRecordSet.Fields("distinguishedName"))[green]
    'Add the X500 Address[/green]
    objUser.PutEx ADS_PROPERTY_APPEND, "proxyAddresses", Array("X500:" & x500Base & objRecordSet.Fields("sAMAccountName"))
    objUser.SetInfo
    objrecordset.MoveNext
Wend

objConnection.Close
[green]'Notify user we are done[/green]
MsgBox "Done"

An alternate method to using a script is to use ADModify.

1. Launch ADModify and select Modify Attributes.

2. Select your domain in the Domain List and your domain controller in the Domain Controller list and hit the green arrow button.

3. Traverse thru your domain tree until you locate the OU which contains the migrated users and select Add to List.

4. Highlight the users from that OU that you wish to modify then click Next.

5. On the Custom tab, check the boxes for "Make a customized attribute modification" and ôMultivalued Appendö. Enter the values as follows then click Go!.

Note: You must modify the values accordingly, with the legacyExchangeDN you retrieved from the source domain. Do not copy and paste the values from this blog post.

Attribute Name: proxyAddresses

Attribute Value: X500:/o=YourOrgHere/ou=first administrative group/cn=Recipients/cn=%ÆmailNicknameÆ%

Note: In some cases the userÆs mailnickname may have changed, if this is the case you will not be able to do the bulk edit and will have to manually add the x500 address for those users.

Note: AD Modify instructions taken from http://blogs.technet.com/sbs/archive/2009/05/21/cannot-reply-to-old-emails-or-modify-old-calendar-items-after-pst-mail-migration.aspx.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top