Need to Change Hostname for Windows Server Domain Controller?
If you promoted your server to a domain controller, you won't be able to change the hostname for Windows Server Domain Controller without inputting commands in the command prompt. Basically, you need to open the command prompt, add a new alternate hostname, make the domain controller your primary hostname, reboot your server, and then remove the old hostname. This is useful if the server's hostname was not changed before the server gets promoted as a domain controller. The order of commands along with the syntax is as follows:
netdom computername oldcomputername.yourlocaldomain.lan /add:newcomputername.yourlocaldomain.lan netdom computername oldcomputername.yourlocaldomain.lan /makeprimary:newcomputername.yourlocaldomain.lan shutdown /r /t 0 netdom computername newcomputername.yourlocaldomain.lan /remove:oldcomputername.yourlocaldomain.lan
- The command to execute.
- Old hostname (example:
- Local domain name (example:
- New hostname (example:
- Adds a new hostname to the domain controller as an alternate hostname. For this example,
newcomputernamewill be added as an alternate hostname for the domain controller.
- Makes a hostname a primary name for the domain controller.
newcomputernamewill be the primary name for the domain controller and the
oldcomputernamewill be the alternate hostname for the domain controller.
- Deletes the hostname from the domain controller. In this case, the
/removeflag removes the
oldcomputernamefrom the domain controller.
- Although not shown in the order of commands above this list of commands, parameters, and flags, this will enumerate the list of hostnames assigned to the domain controller. This flag does not require a parameter, so the colon after the enumerate flag is not needed.
shutdown /r /t 0
- This command reboots the server (hence,
/r) immediately (
/t 0. The
/t 0flag and parameter is a timer.
- Not shown in the list of commands above. This command runs a diagnostic for the domain controller to make sure everything in the domain controller is working fine. There might be some errors and warnings, but if computers can login to the domain controller, it should be fine.
Because I did not know the commands myself, I must give credit to "The ICT Guy" (Twitter profile) for writing an article titled Correctly renaming a Domain Controller for a seamless easy migration. That article has been of great help to me since I am testing Windows Server 2016 Essentials edition as part of my virtual homelab setup. For example, I wanted to test the domain joining functionality in macOS and test an Active Directory integration in Nextcloud using an LDAP/AD integration app. LDAP stands for Lightweight Directory Access Protocol and is used for managing users and groups.
I hope I can be of help to Windows administrators.
Article published: 2022-09-25 01:15
Categories: The World of Computers, Information Technology,