daknetworks.com

You are here: Blog Rename User Active Directory

Rename User Active Directory

Rename user in Active Directory is a common task but putting it all in one spot

Rename User in GUI

-open Active Directory Users and Computers.
-right-click on the Name.
-select RENAME.
(rename User dialog box appears to change other common items)

Rename User in CMD

dsmove "<UserDN>" -newname "<NewUserName>"
dsmod user "<UserDN>" -upn "<NewUserUPN>" -ln "<NewUserLastName>"

Rename User in PS

rename-adobject "oldname" "newname"
or
Get-ADUser -Identity 'oldname' | Rename-ADObject -NewName 'newname'

For a full one-liner:
Get-ADUser "old.name" |Rename-ADObject -NewName “New Name” | Set-ADUser -GivenName “New” -Surname “Name” -DisplayName “New Name” -SamAccountName “newname” -UserPrincipalName " This e-mail address is being protected from spambots. You need JavaScript enabled to view it

NOTES:

All the following are different:

Name
GivenName
Surname
SamAccountName
DisplayName
OtherName
UserPrincipalName

Most can be set by: Set-ADUser

But the Name of the Object is a bit different and needs to be set by: Rename-ADObject

Check your work by using Get-ADUser.

Here is Get-ADUser:
https://docs.microsoft.com/en-us/powershell/module/addsadministration/get-aduser?view=win10-ps

Here is Set-ADUser:
https://docs.microsoft.com/en-us/powershell/module/addsadministration/set-aduser?view=win10-ps

Here is Rename-ADObject:
https://docs.microsoft.com/en-us/powershell/module/addsadministration/rename-adobject?view=win10-ps

Contact Dak Networks

We are not taking on new clients at this time.