Change User Principal Name for Email Addresses

To fix E-mail authentication in situations where the domain name is test.com and the email account is testusers.com.

Create a new OU named test and new user named Joe User then place him in that new OU

Open Exchange management shell and follow the below steps

1)      Get-ADServersettings

2)      Change the Recipient view root to the New OU created above

3)      Set a variable for the users

  1. Get-mailbox
  2. $users = Get-Mailbox
  3. $users | ForEach {Set-User –Identity $_.Identity –UserPrincipalName $_.WindowsEmailAddress –Whatif}
  4. If all completes successfully then remove the –WhatIf statement and run again

4)      Check their AD account properties and click on account then see if it has been changed to their email address. If so then you are safe to do it to either more OU’s or then entire forest.

5)      To change the entire forest do the following

  1. Set-ADServersettings – RecipientViewRoot “test.com”
  2. Set-ADServersettings –ViewEntireForest $true
  3. Get-Mailbox
  4. $users = Get-Mailbox
  5. $users | ForEach {Set-User –Identity $_.Identity –UserPrincipalName $_.WindowsEmailAddress –Whatif}
  6. If all completes successfully then remove the –WhatIf statement and rerun

6)      Verify everything has been modified correctlyImageImageImage

Advertisements