andThenYouDie

Automation, IT and more.

04 May 2020

Rename an Windows Domain Controleur

Need to rename an Active Directory server ?


Who never do stupid error? especially when it’s not your core univers.

So I forgot to rename the server before adding it as an AD Controleur and I get this stupid server name WIN-447M7O4KJDC. What to do ? It’s not over, and if the server is just a Controleur, it’s should be painless.

Remember, I’m not an Windows expert.

First find the name of your server:

C:\Users\Administrator>hostname
WIN-447M7O4KJDC.lan.metabunker

Then use the netdom command to confirm the name of the machine:

C:\Users\Administrator>netdom computername WIN-447M7O4KJDC.lan.metabunker /enumerate
All of the names for the computer are:

WIN-447M7O4KJDC.lan.metabunker

The command completed successfully.

So now, it’s time to add the new name of the server:

C:\Users\Administrator>netdom computername WIN-447M7O4KJDC.lan.metabunker /add:dc02.lan.metabunker 
Successfully add dc02.lan.metabunker 
as an alternate name for the computer.

The command completed successfully.

Check if you have the two name:

C:\Users\Administrator>netdom computername WIN-447M7O4KJDC.lan.metabunker /enumerate
All of the names for the computer are:

WIN-447M7O4KJDC.lan.metabunker
dc02.lan.metabunker 

The command completed successfully.

Time to switch primary name:

C:\Users\Administrator>netdom computername WIN-447M7O4KJDC.lan.metabunker /makeprimary:dc02.lan.metabunker 
Successfully made dc02.lan.metabunker 
the primary name for the computer. The computer must be rebooted for this name 
change to take effect. Until then this computer may not be able to authenticate 
users and other computers, and may not be authenticated by other computers 
in the forest. The specified new name was removed from the list of alternate 
computer names. The primary computer name will be set to the specified new 
name after the reboot.

The command completed successfully.

Reboot the server:

shutdown /r /t 0

Check the name of your server:

C:\Users\Administrator>hostname
dc02.lan.metabunker

List all the name of the server:

C:\Users\Administrator>netdom computername dc02.lan.metabunker /enumerate
All of the names for the computer are:

dc02.lan.metabunker 
WIN-447M7O4KJDC.lan.metabunker

The command completed successfully.

So now it’s time to remove the old name:

C:\Users\Administrator>netdom computername dc02.lan.metabunker /remove WIN-447M7O4KJDC.lan.metabunker 
Successfully removed WIN-447M7O4KJDC.lan.metabunker 
as an alternate name for the computer.

The command completed successfully.

Tadam, it’s finish, your server now has a new name.