Install Active Directory Domain Service via PowerShell

Hello Guys 🙂

Today its about Windows Server 2012 R2 , adding  Active Directory  Domain Service (AD DC) role to server using PowerShell

For this you can use PoweShell console or PowerShell ISE as you prefer  make sure you the console is with administrator mode

Hope you ready to ride with me 🙂 🙂 then lets start

Open  PowerShell or PowerShell ISE with administrator privilege, you can find PowerShell in task bar or go to start and type powershell

Note:- Try this in a virtual environment 

Step 1

First you have to verify the AD DS was installed in the server,enter following command in PowerShell console


Step 1

If the Active Directory Domain Service was “[X] ” it was installed in to the server as per our example it is available but not install so we going to install that feature

Step 2

this is the step we install the role of AD DS to the server enter the following command

Install-windowsfeature -name AD-Domain-Services -IncludeManagementTools

Step 2

This will install the role to the server and if it success it shows the Success: True

-IncludeManagementTools  parameter installs the management tools that needs to configure users,groups,organizational units(OU).As shown in the above FeatureResult  shows which tools installed to server in this step AD DS install but there no forest or domain created in AD DS so next step lets walk through how to create a forest and domain

Note:-  Ignore the warning shown in the snap shot  🙂 

Step 3  

Before create a forest and domain we should import the AD DS related PowerShell cmdlets to the current PowerShell session  let’s do it 🙂 . Run the following command

Import-Module ADDSDeployment

Step 3

Step 4

Now we are ready to create a forest and domain in the server. Fores is the most highest position in the domain controller hierarchy  in one forest we can have multiple domains. Lets see the command to create a forest 😀

Install-ADDSForest `
-DatabasePath “C:WindowsNTDS” `
-DomainMode “Win2012R2” `
-DomainName “rajapakse.local” `
-DomainNetBIOSName “RAJAPAKSE” `
-ForestMode “Win2012R2” `
-InstallDNS:$true `
-LogPath “C:WindowsNTDS” `
-NoRebootOnCompletion:$false `

Step 4Step 5

When you run the  command it prompt to set the SafeModeAdministratorPassword enter the password and click OK then it prompt again to confirm the password enter the same password you entered previously  click OK . Congratulation you create a domain in the server. There is one thing to tell you, did you notice the ~ at the end of the line it means break to next line you can type full command in single line but for better readability i divide it to multiple lines

After you confirm the password and click OK its start to create the domain and forest as follows

Step 6Note:- Ignore the warnings 🙂 

After few minutes server will restart and log as an administrator of the domain control you can verify the installation of AD DS by opening the Server Manager and you will notice in the dashboard  server called AD DS as follows

Step 7

Voila  You done it Congtatz  🙂 😀 😀

Have a nice day 🙂 🙂

See you Soon

Bye for now