Technick

Correctly Renaming a Domain Controller

A practical rename procedure for a domain controller when the hostname needs to be corrected without turning the migration into unnecessary drama.

This walkthrough adds the new name as an alternate computer name, makes it primary, reboots, verifies the result, removes the old hostname, and finishes with validation and cleanup.

Source: Correctly Renaming A Domain Controller For A Seamless Easy Migration

Step 1: Getting ready.

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

Step 2: Adding an alternate computer name.

Syntax

netdom computername <currentDC FQDN> /add:<newDCName FQDN>
Command prompt showing the alternate computer name being added
renaming a domain controller

In the command prompt, type netdom computername wrongname.domain.local /add:server.domain.local.

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

Enumerating computer names after adding the alternate domain controller name
Enumerating computer names after adding the alternate domain controller name

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

Output showing both names listed for the domain controller
Output showing both names listed for the domain controller

Step 3: Make the new name the primary.

Syntax

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

Run netdom computername wrongname.domain.local /makeprimary:server.domain.local.

This command should return successfully and warn that you need to reboot immediately. That warning matters, especially if this is the only domain controller in the forest.

Command prompt making the new domain controller name primary
Command prompt making the new domain controller name primary

If the command is successful, you should get the expected confirmation message.

Successful output after making the new domain controller name primary
Successful output after making the new domain controller name primary
Important: Reboot immediately after this succeeds. Until then, authentication may not behave correctly.

Step 4: Reboot the server.

Pick your poison. I like shutdown /r /t 0 in the command prompt.

Command prompt rebooting the domain controller
Command prompt rebooting the domain controller

shutdown /r /t 0

Step 5: Check new server name.

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

Enumerating names after reboot to confirm the new server name
Enumerating names after reboot to confirm the new server name

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

Command prompt removing the old domain controller hostname
Command prompt removing the old domain controller hostname

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

Step 7: Paranoia.

In cmd, run 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.

Back to notes