Now that you had learned How to Install & Uninstall Existing Domain Controller Using the Graphic User Interface (GUI), let me I have to take the trip around the Installing-Uninstalling Existing Domain Controller Using PowerShell on Windows Server 2016, But It also can be done on Windows Server 2012, 2012R2, and 2008.
Before going on, first, you have to install the ADDS role. Here is the article How to Install it with PowerShell.
Installing-Uninstalling Existing Domain Controller Using PowerShell
Install Existing Domain Controller Using PowerShell
Step 1. First, change Command Prompt to PowerShell by PowerShell on the shell.
Step 2. Since you are trying to install an Existing Domain Controller, first we have to find out the command for it.
In order to find out the command, I will simply search for Active Directory Command by typing this cmdlet.
gcm is an alias which stands for get-command, and the two stars which you are looking at the both side of ADDS, they are a parameter for the search option in PowerShell.
Now you can see list the cmdlets for the ADDS, since you want to install the Existing Domain Controller, just copy the Command.
Step 3. To Install it on the server, type the cmdlet of Existing Domain Controller, then you have to type down the Domain Name of the Server which you want to add on it an additional domain, after that, you will be asked for the Safe mode Administrator Password with the confirmation. Here is the Demo:
- Install-ADDSDomainController –DomainName Techroze.Local
- SafeModeAdministrator: type your Password
- Confirm SafeModeAdministrator: Again type your Password
After that you will be asked that the target server will be configured as a Domain Controller, Are you positive?
You have to type “Y” and Press “Enter”.
When you pressed enter on the keyboard while installing of the domain you will see many errors back to back, don’t worry. After installation, the system will restart to configure the changes.
Uninstall Existing Domain Controller Using PowerShell
Step 1. First, change Command Prompt to PowerShell by PowerShell on the shell just as you did while installing it.
Step 2. Since you are trying to uninstall an Existing Domain Controller, first we have to find out the command for it.
Just as searched for the installation Cmdlet, just like that, you to search for the cmdlet. Here is the Demo.
Now that we have found the command, which the first command listed in the list.
Step 3. To remove it from Server, type the cmdlet of uninstalling Domain controller, then you have to the Local Password of Administrator by which you are logged in. Here is the Demo:
- LocalAdministratorPassword: Type your Password
- Confirm LocalAdministratorPassword: Confirm your Password
After typing the cmdlet, it will tell you that, the Server Restart after the operation, this will be no longer exist on the domain controller.
You have to type “Y” and Press Enter.