Creating Domain Controller With Powershell

In this blog we will learn how to create a domain controller in Windows Server 2012 using Powershell.

Normally, you can create a domain controller via Server Manager by adding AD Domain Services roles & features.

But, there's a better way!

Executing a 4-line powershell script will help you accomplish same goal.

You can change $sampledomain variable as in the following code snippet: 
  1. $sampledomain = "iersoy.com"   
  2. $AdminPass = ConvertTo-SecureString "P@$$w0rd1" -asPlainText -force   
  3. Add-Windowsfeature AD-Domain-Services -IncludeManagementTools   
  4. Install-ADDSForest -DomainName $sampledomain -SafeModeAdministratorPassword $AdminPass -Confirm:$false  
After executing this script in Administration mode in Windows Powershell, you'll be having a reboot.

Once you restart and Windows login screen appears, you shall see forest name starting with "IERSOY/{youradminusername}" .