Windows Active Directory Domain Rename (Using Windows PowerShell Script & Syntax)

Created a Domain Name "bibek.local

 to making a process of 

Rename "Windows Active Directory Domain" Name 

This is an only domain controller and now going to change "bibek.local" to "mylabsupport.local" running on Windows Server 2019 by VMware Workstation.


Before starting the Domain Renaming process

it is highly suggested to backup the domain controller incase something goes wrong

we can revealed domain controller again with the help of backup. 

Go to Tools and click on "DNS Manager".


In the first step create a New Active Directory integrated DNS Zone

 using new domain name in DNS Server. 

Expand "Forward Lookup Zones". Here we can verify existing Active Directory-Integrated primary DNS Zone with the name "bibek.local".


Need to create more Active Directory-Integrated Primary Zone with the name of New Directory Domain. 

So Right-click on "Forward Lookup Zones" and select a New Zone.


Select a "Primary type" of zone and store the zone in

Active Directory-Integrated Domain on this server.


Select how you want Active Directory Zone Replication

to all DNS servers running on domain controllers in this "domain".


Specify a New Domain

"DNS Zone Name". 


Select a option "Allow only secure dynamic updates

(recommended for Active Directory)".


Successfully completed "New DNS Zone" Wizard.


Repeat the process again to create a new Active Directory-Integrated Zone with the name  

"_msdcs.mylabsupport.local".


Repeat Specify the DNS Zone name as 

"_msdcs.mylabsupport.local".


Successfully repeat the process of completing  

with a name  

"_msdcs.mylabsupport.local".


Run "Windows PowerShell" as Administrator. 


We will use commandline utility named "rendom" to rename  the Active Directory domain name. 

First clear the screen.


First of all take a help of commandline utility named "rendom /?". 


"rendom /?List of switches going to use in the forest. 


Let me clear the screen "cls".


"rendom /list" This file is used to Generated a straight file name "domain list.xml

This file contains the current file configuration. 

Generated a "domain list.xml". 


Open and edit a "Domain list".


Then Find "bibek.local" and Replace all with a new name "mylabsupport.local". 

    Also save the NetBios name "MYLABSUPPORT". 


"rendom /showforest" This is going to give us the list of potential changes.

But this step does not make any changes.


"rendom /upload" Next need to upload the file "domain.list" to our forest configuration.

This command upload the rename instructions.


"rendom /prepare" Now need to verify the readiness of each domain controllers.

 

"rendom /execute

This used to verify the readiness of all domain controllers and if they are ready performs are remain actions for each domain controllers. 

Remember there will be a service interruption during this process 
and once the process completed successfully domain controller server will be started automatically


After Reboot again login on Domain Controller.

Press "Ctrl+Alt+Del" key combination. 

Need to click on other user and we can see sign-in to "MYLABSUPPORT"

A new domain name is listed.


Click on Local Server. Here we can see the domain name is changed to "mylabsupport.local".


We can verify from "Active Directory Users and Computers"  

snap-in as well. 


Keep in mind with domain renaming process domain controller name will not change,

those changes we have to rename manually.

Click on "Change".


Click "OK" on domain changes.


Click on "More" option to change domain controller name.

Then change on "Primary DNS suffix of this computer".


We must "Restart Now" the computer to apply the changes. 


After Reboot again login on domain controller and

using the credentials of our domain administrator "MYLABSUPPORT".


When after login try to open a Group Policy Management there found an error.

Because this console using an old domain name which is "bibek.local"

So need to fix this error by PowerShell.


Let's open Windows PowerShell as an administrator again.

Write "gpfixup" command to change dns name for the group policy.

 Start command "gpfixup /olddns:bibek.local /newdns:mylabsupport.local".


Then after you also need to update NetBios name in the Group Policy Console as well.

Write command "gpfixup /oldnb:BIBEK /newnb:MYLABSUPPORT". 


Open "Group Policy Management" perform an "Action" to "Add Forest".


Now we can Expand all Group Policy Settings and Objects of "mylabsupport.local" domain. 


Write command "rendom /clean"

This command is used to remove the references of an old domain name from the Active Directory.


Then need to run the final command "rendom /end"

This command is used to unfridge the forest configuration and successfully allow for the changes for an officially ending the domain renaming process with this command.


From this point successfully renamed an Active Directory Domain name from

"bibek.local to mylabsupport.local".

Comments

Post a Comment