
If you come accross to change the name of a Domain User Account in Active Directory, its not that easy.
First, you need to change the Name in a few places. I have made a Powershellscript to help you out. download it here
Just fill out the Variables and be aware you disconnect your Exchangemailbox first, before you execute it.
After you changed the Name you maybe need to press F5 to refresh.
Make sure you reconnect the Exchangemailbox again.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
## (C) 2016 Adrian Reinhard (reinhard.be) #start on Domaincontroller with Powershell ISE #Import Module Import-Module ActiveDirectory #Variables #Set the old Username here $SamAccountNameBefore=”adrian.reinhart” #Set the new Username here $givenName=”Adrian” $lastName=”Reinhard” $Displayname=”Adrian Reinhard" $sAMAccountName=”adrian.reinhard” $UserName=”adrian.reinhard@yourdomain.ch” $Name=”Adrian Reinhard” $Server=”srvdc01” #Rename-ADObject to change the Name after this there is a little break to change the name completly $User=Get-ADUser -Identity $SamAccountNameBefore Rename-ADObject -Identity $User -NewName $Name -Server $Server sleep -Seconds 10 $User=Get-ADUser -Identity $SamAccountNameBefore Set-ADUser -Identity $User -surname $lastName -givenname $givenname -displayname $Displayname -UserPrincipalName $UserName -SamAccountname $SamAccountName -homeDirectory $homeDirectory -HomeDrive “H:” -Server $Server |