In this tutorial, we will see how to create an Active Directory environment using PowerShell, that is to say the creation of the first domain controller which includes:
- The creation of the forest
- The creation of the domain
The Active Directory tutorial: installing and configuring a domain controller explains how to do it using the graphical interface.
Ideally from a blank server, which is dedicated to this role and configure a fixed IP address for it.
Installing the AD DS role
Open a PowerShell window in Administrator and enter the following command to install the domain controller role.
Install-WindowsFeature AD-Domain-Services -IncludeManagementTools
Wait during the installation …
When the installation is complete, the following message is displayed:
Creating the Active Directory domain
At this stage, the Active Directory environment (Forest and Domain) will be created and the computer promoted to Domain Controller.
To create a new Active Directory forest, use the Install-ADDSForest command, which will create the forest, the first domain, and promote the controller server.
Open a PowerShell window as Administrator and enter the following command to create the Active Directory environment. Adapt parameters
Install-ADDSForest -DomainName "rdr-it.intra" -DomainNetBiosName "RDRIT" -InstallDns:$true -NoRebootCompletion:$true
Enter the restore mode password and confirm the promotion of the server as a domain controller.
Wait while the command is executed.
When the operation is complete, the result of the command is displayed and requests that the server be restarted.
Enter the following command to restart the server
After restarting, the server is a member of the domain and a domain controller.
Now that the domain controller is ready and you are deploying a production environment, I recommend installing a second controller.
Some links on the subject:
- Active Directory administrative console discoveries
- Active Directory: Add a Domain Controller to PowerShell
- Active Directory: Multi Site, Subnet, and Replication Configuration
The other commands used for the installation of a domain controller:
- Install-ADDSDomain : which is used to create a domain in an Active Directory forest (adding a child domain).
- Install-ADDSDomainController : which is used to add an Active Directory domain controller to an existing domain.