Site icon RDR-IT

Create an Active Directory environment in PowerShell

Introduction

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 Active Directory tutorial: installing and configuring a domain controller explains how to do it using the graphical interface.

Prerequisites

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

Install-ADDSForest -DomainName "rdr-it.intra" -DomainNetBiosName "RDRIT" -InstallDns:$true -NoRebootOnCompletion:$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

Restart-Computer

After restarting, the server is a member of the domain and a domain controller.

complements

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:

Exit mobile version