How to Rename a Domain Controller using netdom
Preparation Renaming your DC using netdom Step 1: Open Command Prompt Open command prompt as a domain administrator by pressing Windows Key Step 2: Adding the new name to your DC using netdom Enter the following command to suit your environment, replacing computer names appropriately. Make sure at each stage in this guide you use
30 October 2023 3 min read
If you manage a Windows Server VPS with us and it’s running as a domain controller, you may occasionally need to rename it – for example after a rebrand, or to bring naming in line with a standard. Renaming a domain controller (DC) is riskier than renaming an ordinary server, because other machines and services rely on its name to find it. This guide covers the safe way to do it using Microsoft’s own netdom tool.
Before you start: only attempt this on a healthy domain, and check Active Directory replication is working correctly first (run dcdiag and repadmin /replsummary and confirm both come back clean). If you have more than one domain controller, test the process on a non-production DC first if at all possible.
Preparation
- This guide assumes you are running Windows Server 2012 R2, 2016, or 2019
- You have confirmed Active Directory replication is currently healthy
- You want to rename your DC
Renaming your DC using netdom
Step 1: Open Command Prompt
Open Command Prompt as a domain administrator:
- Open the Start Menu
- Type CMD
- Right-click on Command Prompt
- Select Run as administrator
Step 2: Add the new name to your DC using netdom
Enter the following command, replacing the computer names to suit your environment. Use the fully qualified domain name (FQDN) at every stage of this guide.
netdom computername CURRENTNAME.DOMAIN.LOCAL /add:NEWNAME.DOMAIN.LOCAL
If the command was successful you should receive the following message: Added (NAME) as an alternate name for the computer. The command completed successfully.
Step 3: Verify the name was added successfully
To confirm the new name was added correctly, enter the following command. Use the current name of the computer, not the new name you just added.
netdom computername CURRENTNAME.DOMAIN.LOCAL /enumerate
If this was successful, you should see both names appear in the list.
Step 4: Change the primary DC name
Enter the following command to change the additional computer name to primary:
netdom computername CURRENTNAME.DOMAIN.LOCAL /makeprimary:NEWNAME.DOMAIN.LOCAL
You should receive a message stating that the change was successful and that you should now reboot the server.
Step 5: Reboot your server
Reboot your server either from the Start Menu, or by entering shutdown /r /t 0 into the Command Prompt window.
Step 6: Verify the name change
Once your server has rebooted, open Command Prompt again and enter the following command using your new computer name – again, you should see both names in the list.
netdom computername NEWNAME.DOMAIN.LOCAL /enumerate
Step 7: Remove the old hostname
Once you’ve verified that your computer responds to the new hostname, remove the old name:
netdom computername NEWNAME.DOMAIN.LOCAL /remove:OLDNAME.DOMAIN.LOCAL
Step 8: Check for issues
Run the following command to confirm everything on your DC is functioning correctly:
dcdiag
If dcdiag reports any errors, resolve them before considering the rename complete – don’t leave a DC in a partially-renamed state. If you’re not confident diagnosing an AD error, our support team can help.