Create an Active Directory environment in PowerShell


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
Install windows feature

Wait during the installation …

When the installation is complete, the following message is displayed:

Install completed

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 -DomainName and -DomainNetBiosName.

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.

Confirm command

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.

Install completed

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:

The other commands used for the installation of a domain controller:

Related Posts

Add an AD DS domain controller to an existing domain

In this article, I will explain how to add a domain controller to an existing domain and manage replication links. Below, an illustration of the final architecture: Throughout this tutorial, we will a

Jenkins: centralizing the management of scheduled tasks

Jenkins is a free open source software for continuous integration. It is normally used by development equipment to ensure non-regression of source code. In turn, it is possible to use Jenkins as a sch

Join a computer to an Active Directory domain

To join a computer to a domain you have several possibilities: By graphical interface Command Line (CMD, PowerShell) Prerequisites be an administrator on the local workstation. have an account on the