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 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.

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

Apply a GPO to a group

Introduction In this article, I will explain how to apply a Group Policy (GPO) to an Active Directory group that contains multiple users. The tutorial also applies in case you want to apply the policy

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

Active Directory: Add a Domain Controller to PowerShell

Table Of ContentsIntroductionPrerequisitesInstalling the ADDS role in PowerShellDomain Controller Promotion in PowerShellComplements Introduction In this tutorial, we will see how to add an Active Dir

Scroll to Top