Correctly renaming a Domain Controller for a seamless easy migration

**NEW** – Try out our command generator to rename your Domain Controller here

Renaming a domain controller using netdom so migrations are seamless to end users

This article is for you if…

  • You have a Windows 2016 server (these steps are also applicable to 2019 and 2012 R2)
  • You want to rename your domain controller
  • You renamed your domain controller wrong and now you see DCDIAG errors and references to the old name
  • You manually updated the File Replication Service entries in Active Directory.
  • You renamed your Domain Controller via the System GUI

This article assumes that your have a new DC installed, follow this guide to install the Server OS if not.

If don’t already have a domain in place then it might be best to head over to this guide which will guide you through setup of a new forest and domain.

If you are running in a none production environment and are following this guide for testing only you can download an evaluation copy of Server 2019 from Microsoft here.

Words of caution

If you rename your DC by renaming a Domain Controller in the normal way you would rename a computer (using the System > Rename this PC gui), you didn’t do it right and your metadata is likely irreversibly damaged. However I have seen success in this situation when multiple DC’s exist by demoting a re-promoting the DC. If only a single DC exists i would say its maybe a good idea to follow the below guide as it may get your out of the proverbial but probably not recommended and you may have to rely on backups.

We take no responsibility if you get this wrong. However if you do have issues we are happy to respond to emails.

What will happen to clients using this DC?

During the renaming process the below services will be impacted but can be mitigated by having a second DC in place.

  • DNS – any client that are using your server for DNS while the process is taking place will not be able to request DNS resolves. The lookup zones will be re-created during this process and may take time to regenerate.
  • DHCP – If DHCP is installed on the server also this won’t be affect by the rename itself but will be during the server reboot which is a requirement.
  • Any other services for example File Services, Print Management etc – The rename wont affect these directly but it will be affected during the reboot.

Step 1: Getting ready.

Open a command prompt. (Windows key+r (run) + cmd)

Step 2: Adding an alternate computer name.

SYNTAX : netdom computername <currentDC FQDN> /add:<newDCName FQDN>

so, in the command prompt, type (sans quotes) “netdom computername wrongname.domain.local /add:server.domain.local”

This should return with “Added (NAME) as an alternate name for the computer. The command completed successfully.

renaming a domain controller
renaming a domain controller – adding the new name

Step 3: Make the new name the primary.

SYNTAX: netdom computername <currentDC FQDN> /makeprimary:<newDCName FQDN>

so, we type netdom computername wrongname.domain.local /makeprimary:server.domain.local

IMPORTANT: This command will return successful, and warn you that you need to reboot immediately, as it may not authenticate logons (very important if only DC in forest)

renaming a domain controller
renaming a domain controller – make the new name primary

Step 4: Reboot the server.

Pick your poison. I like “shutdown /r /t 0” in the cmd.

Step 5: Check new server name.

Go to system properties and confirm new computer name.

renaming a domain controller
renaming a domain controller – enumerating all the hostnames

Step 6: Remove old hostname.

SYNTAX: netdom computername <newDCName FQDN> /remove:<oldDCName FQDN>

(remember, in a command prompt)

so, “netdom computername server.domain.local /remove:wrongname.domain.local”

Command should return successfully.

2020 05 19 19 17 05 Window
renaming a domain controller – removing the old name

Step 7: Paranoia.

in cmd, run a “dcdiag” to make sure everything is AOK.

Step 8: Clean up.

If you use logon scripts, remember to update the UNC paths with the new server name.

For any further help in renaming a domain controller please contact us here

If you found this article helpful, would you consider buying me a Coffee?