Correctly renaming a Domain Controller for a seamless easy migration

35
Correctly renaming a Windows Server Domain Controller for a seamless migration

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

This article is for you if…

  • You have a Windows 2019 server (these steps are also applicable to 2022, 2016 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 an existing DC to rename or a new DC installed you are wanting to move to, 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.

Command Generation tool

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

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>

2021 11 08 14 07 22 Correctly Renaming A Domain Controller For A Seamless Easy Migration and 1 more
renaming a domain controller

In the command prompt, type (minus 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.

2021 11 08 14 08 56 Correctly Renaming A Domain Controller For A Seamless Easy Migration and 1 more

To check the name has applied correctly run “netdom computername server.domain.local /enumerate” you should then see there are two names listed.

2021 11 08 14 09 27 Correctly Renaming A Domain Controller For A Seamless Easy Migration and 1 more
renaming a domain controller

Step 3: Make the new name the primary.

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

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)

2021 11 08 14 11 15 Correctly Renaming A Domain Controller For A Seamless Easy Migration and 1 more
netdom computername wrongname.domain.local /makeprimary:server.domain.local

If the command is successful you will get the below message.

2021 11 08 14 11 37 Correctly Renaming A Domain Controller For A Seamless Easy Migration and 1 more

Step 4: Reboot the server.

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

2021 11 08 14 12 32 Correctly Renaming A Domain Controller For A Seamless Easy Migration and 1 more
shutdown /r /t 0

Step 5: Check new server name.

Go to system properties and confirm new computer name. Or run “netdom computername server.domain.local /enumerate” to see both active names.

2021 11 08 14 13 48 Correctly Renaming A Domain Controller For A Seamless Easy Migration and 1 more
netdom computername server.domain.local /enumerate

Step 6: Remove old hostname.

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

(remember, in a command prompt)

Type “netdom computername server.domain.local /remove:wrongname.domain.local

2021 11 08 14 13 19 Correctly Renaming A Domain Controller For A Seamless Easy Migration and 1 more
netdom computername server.domain.local /remove:wrongname.domain.local

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

Found priceless insights in this blog? Support the author’s creativity – buy them a coffee!

35 thoughts on “Correctly renaming a Domain Controller for a seamless easy migration

  1. I like the valuable information you provide in your articles.

    I’ll bookmark your blog and test once more here regularly.
    I am somewhat sure I’ll be told many new stuff right here!
    Best of luck for the next!

  2. so when I try to run the command I get an error: Cannot create a file when that file already exist.

    I am trying to rename a DC to have the name of an old DC that was demoted and removed from the network. The old DC is completely gone, properly demoted, verified it is no longer listed in sites and services. Not sure what else to check.

  3. Thanks a lot, working great, i had a trust relationship established between two DC, that i removed the time to rename my new DC, then created the trust relationship back, i had no trouble except an error running DCDiag : the test failed for DFSREvent but i have only One DC so nothing to replicate to : for me its a false positive .

  4. Great article!

    My current environment has two DCs, replicating to one another. How can I rename the DC with your approach? What should I be concerned about? Any advice?

    1. If the dcs are virtual I would standard snapshot both then you can go ahead and rename the required dc. Once done and you have checked replication and logins are all working remove the snapshots.

  5. Great info here lad and a simple solution for a newbie like me. I wish to know it before messing with my test server computer name…

  6. I took over my domain/network environment from a former Network Admin over a year ago. One of my 2 replicated DCs is called TEMP-DC-10 and I have been wanting to change it to match the naming scheme for the rest of the Hyper V servers on the domain. But I was afraid of all the unknowns that could happen from this. but now this gives me the confidence to do it. I’m going to give this a shot over the weekend.

    Thanks for writing this up!

    1. No worries. If your dc is virtual why not take a snapshot of both dc’s prior incase it messes up you can revert both.

  7. Hi,

    I have AWS EC2 Win2019 Instance that acts as Domain Controller. By default it has got the AWS provisioned name.

    I have removed the Instances from DC and followed the above steps . Now I am unable to login to it.

    Any suggestions?

  8. Question, If I want to keep the old server (2008) running as a secondary server and backup dns (until I replace it) but just change the name of it and then also renaming my new server with the old name will I have any issues ?

    1. Personally I think you would be better following this guide, then promoting a new server for a secondary. Domain controllers can do weird things when old DCs exist, plus for this to work correctly there needs to be no record of the old one at all otherwise it will fail.

      1. Hi all!
        i did that job – migration from 2008R2 up to 2019- twice. Once on GUI, directly, and glamorous failed . After reinstalling Windows 2019, and following your suggested way, it got to success.
        Thanks for publishing!

  9. Thank you for this how-to. But I have a question for you. I have 2 2012 R2 DC. 1 is virtual – Primary and the 2nd is physical – secondary, backup, I have a new VM 2019 Server created. I am going to migrate the Primary data to the new 2019. I want the new 2019 DC to have the same IP address as the old DC and the name, so I don’t have to go to all the places I have the DNS server info hard coded. Will your method here work in this scenario?
    Then I am going to upgrade the physical server to 2019 by demoting and doing in an place upgrade. Can I keep the old VM DC as secondary? It is kind of related to your article.

  10. Hello from Brazil!

    I have a question: if I have a domain whose fqdn is myenterprise.local and I wish to rename it to myenterprise.com.br or ad.myenterprise.com.br, can I use this tutorial?

    Gratz for your work!

    1. Hey, unfortunately not. This guide is to rename a domain controller not the domain. In all honesty I wouldn’t attempt a domain rename either stick with the existing or start a fresh the can of worms you will open you’ll end up starting again anyway.

  11. I messed up a 2019 DC by renaming it incorrectly. Now my NETLOGON service does not start. DCDIAG still is looking at the old name and says the GC, AD etc… cannot be found.

    IS there anything I can do to fix this mess?

    1. Hi,

      If you run the enumerate command does it return the names? I would try running with both the old a new hostnames.

      netdom computername server.domain.local /enumerate

      If you can get this to return a result there is a good chance it can be rescued.

  12. Hi,
    I have one domain controller and I’m spinning another with new hardware.
    1. Do I promote the new domain controller?
    2. Then demote the old one?
    3. The rename the new old and change the ip?

    1. Yes, basically.

      Promote a new DC, completely remove the old then rename the new to the old name and give it the same IP, should be seamless to end users.

      1. How about demoting the current DC (with another one on the network) then renaming in the GUI. Then on the new server rename it in the GUI to the old name then promote it to DC?

        1. Renaming in the GUI will break your domain, unfortunately, as it does not update the name in other locations which is required. Doing this, you will end up either rolling back backups or re-creating your domain.

      2. hey, let’s say i have olddc1 and newdc1 then demoted olddc1 and promoted newdc1 . So if i rename newdc1 to olddc1 , other DCs won’t recognize my newdc1 with olddc1 name because it has demoted. So what should i do ?

        1. You should promote the new DC prior and then demote the old, remove any traces of the old from AD and then add the old name to the new DC then remove the old you should have no issues.

  13. I have two DC’s in different subnets. The Sysvol folder is acting weird. Sometimes.

    I’ve narrowed it down to the following:
    -sysvol contents are different on both machines
    -replication completes successfully, yet missing items on the secondary.
    -going to //domain.local/sysvol -works
    -going to //machinename12345/sysvol -does not work
    -going to //machinename1234/sysvol -works (note 15 chars!)

    I had to make a DNS entry for machinename1234 to resolve because the server us using the 16 char version for it’s DNS entry.

    It looks like the NETBIOS limit might be the culprit in the intermittent failures I’m seeing when workstations apply. When the second DC is the login server for the workstation, it works. When the primary is the login server, it fails.

    Will renaming the primary DC to the machinename1234 to bring it to the NETBIOS 15 char limit maintain the replication and whatnot or will I have to redo the replication? It’s for two sites that connect via a VPN.

Leave a Reply

Your email address will not be published. Required fields are marked *