Install Domain Controller in Server 2012 using Windows PowerShell

Spread the love




PowerShell is a powerful command line tool that let’s you do all the cool things that GUI can’t do. Here, I will show steps to install Domain Controller in Server 2012 using Windows PowerShell. The installation is similar to GUI installation but involves PowerShell cmdlets.

Install Domain Controller in Server 2012 using Windows PowerShell

Make sure you have installed Server 2012. Other important pre-configurations are static IP address and computer name. Here is our scenario.

Install Domain Controller in Server 2012 using Windows PowerShell

We will install domain controller in MBG-DC1 using Windows PowerShell which has static IP address of 192.168.80.1. So, let’s get started.



Step 1: Check AD DS Role Availability

At first, let’s check the status of AD DS role. Open Windows PowerShell and hit the following cmdlets.

PS C:\Users\Administrator> Get-WindowsFeature AD-Domain-Services

Step 2: Install AD DS Roleget-windowsfeature

We can see it is available, so let’s install AD DS role by typing following cmdlets.

PS C:\Users\Administrator> Install-WindowsFeature -Name AD-Domain-Services

Install Domain Controller in Server 2012 using Windows PowerShell

You will see following screen after finishing the install of the AD DS feature.

Installation Complete

Step 3: Perform Prerequisite Checks

Before promoting the server to DC, we can perform some checks to ensure everything is OK. Let’s do the test at forest level at first.

PS C:\Users\Administrator> Test-ADDSForestInstallation

Now, let’s perform domain level test.

AD Forest Test

PS C:\Users\Administrator> Test-ADDSDomaininstallation

Now, test the domain installation at DC level.

Domain Level Test

PS C:\Users\Administrator> Test-ADDSDomaControllerIninstallation

Step 4: Promote Server to Domain Controller

Domain Controller Installation Test

To promote the domain controller, paste the following cmdlets in you notepad and create a script.

#
# Windows PowerShell script for AD DS Deployment
#
Import-Module ADDSDeployment
Install-ADDSForest `
-CreateDnsDelegation:$false `
-DatabasePath "C:\Windows\NTDS" `
-DomainMode "Win2012" `
-DomainName "mustbegeek.com" `
-DomainNetbiosName "MUSTBEGEEK" `
-ForestMode "Win2012" `
-InstallDns:$true `
-LogPath "C:\Windows\NTDS" `
-NoRebootOnCompletion:$false `
-SysvolPath "C:\Windows\SYSVOL" `
-Force:$true

PS C:\Users\Administrator\Desktop> Set-executionpolicy remotesignedCopy the script in notepad and then save as InstallDC.ps1. Then type following cmdlet to change the PowerShell execution policy and execute the script.

PS C:\Users\Administrator\Desktop> .\InstallDC.ps1

AD DS PromoteYou will see following messages during the install. After the install the server will restart. Domain controller has successfully been installed. You can now create user accounts, computer accounts, etc. to manage your domain environment.




The following two tabs change content below.
Bipin is a freelance Network and System Engineer with expertise on Cisco, Juniper, Microsoft, VMware, and other technologies. You can hire him on UpWork. Bipin enjoys writing articles and tutorials related to Network technologies. Some of his certifications are, MCSE:Messaging, JNCIP-SEC, JNCIS-ENT, and others.

Latest posts by Bipin (see all)

scroll to top