While setting up my Active directory lab, I forgot to rename the name on domain controller. You can use this procedure to rename domain controller name. Here I am going to use NETDOM command line utility. Although you can rename it through graphical user interface by using the System Properties but that is not recommended method by Microsoft.
Open Powershell (Run as administrator) on the domain controller where you want to change the hostname.
Here for demo purpose I have ran below command to check how many domain controllers I have.
Get-ADDomain | Select ReplicaDirectoryServers
And the next command is $env:COMPUTERNAME shows what is the current name is. This way I can ensure I am renaming correct host.
Once you verify that you are on correct domain controller, below command i have run to add new domain controller name
netdom computername WIN-BDUEMS81I1N /add:AD002
WIN-BDUEMS81I1N is my existing host name which i want to change to AD002.
It will ask for confirmation proceed pressing Y. once command is successful fire next command. this command will make AD002 as primary name.
netdom computername WIN-BDUEMS81I1N /makeprimary:AD002
Once the command executed successfully restart computer. After reboot check the system properties or run hostname command in command prompt to verify that server name has been changed correctly.
And below is the final command to remove old server name.
Netdom computername AD002 /makeprimary:WIN-BDUEMS81I1N
Troubleshooting and Verification
To verify everything is successful I check nslookup for the server from desktop in the vcloud.lab domain.
I got failure message. after checking in DNS server I still found the old entry. at this point just restart server once to get the name register in DNS correctly if this doesn't resolve the issue. Add primary DNS suffix in system properties > Computer Name > Change > More. and restart server once.
This should resolve your issue. incase if you are still getting nslookup error. check if old computer entry is still present in DNS if yes then remove it and add this domain controller's entry.
Deleting old entry.
Adding new entry for AD002.
Once you get this successful, check AD related entries in DNS whether they are reflecting new name correctly.
Next step is to check replication and DCDIAG for any errors, I checked repadmin /replsum to see summary of replication and it was successful.
While checking dcdiag I got below failure messages and i will be correcting those in next blog DCDIag - failed test DFSREvent.
Starting test: DFSREvent
There are warning or error events within the last 24 hours after the SYSVOL has been shared. Failing SYSVOL replication problems may cause Group Policy problems.
......................... AD002 failed test DFSREvent
There are warning or error events within the last 24 hours after the SYSVOL has been shared. Failing SYSVOL replication problems may cause Group Policy problems.
......................... AD002 failed test DFSREvent
3 comments:
Thanks for your article, very useful.
Just a little mistake in the command line to remove old Server name that should be:
netdom computername NewCurrentComputerName /remove:OldComputerName
Post a Comment