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
netdom computername
- The command to execute.
oldcomputername
- Old hostname (example:
WIN-R61PT45
). yourlocaldomain.lan
- Local domain name (example:
graysonpeddie.lan
) newcomputername
- New hostname (example:
grayson-dc1
) /add
- Adds a new hostname to the domain controller as an alternate hostname. For this example,
newcomputername
will be added as an alternate hostname for the domain controller. /makeprimary
- Makes a hostname a primary name for the domain controller.
newcomputername
will be the primary name for the domain controller and theoldcomputername
will be the alternate hostname for the domain controller. /remove
- Deletes the hostname from the domain controller. In this case, the
/remove
flag removes theoldcomputername
from the domain controller. /enumerate
- 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 0
flag and parameter is a timer. dcdiag
- 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,