Installing Domain Controllers Via Powershell

Anyone who has ever been an AD admin has gone through the fun song and dance of standing up a new domain controller. As an avid user of PowerShell I wanted to provide a quick easy way to standup a new forest and secondary DC without “clicking it to death” rather simply using a couple of quick easy PowerShell statements.

Standing Up First DC (New Forest)
If you are adding a DC to an existing Forest you can skip this section

  • Complete pre-reqs of setting static IP, changing hostname’s etc, then run PowerShell as admin and run the following:
  • Install-WindowsFeature AD-Domain-Services
  • Once the installation has completed the binaries are installed, however the forest has not been created yet. To create a forest run the following cmdlets:

Install-ADDSForest -DomainName example.local -ForestMode <Win2003|Win2008|Win2008R2|Win2012|Win2012R2>

Adding an Additional Domain Controller

  • Complete pre-reqs of setting static IP, changing hostname’s etc, then run PowerShell as admin and run the following:

Install-WindowsFeature AD-Domain-Services

  • Once the binaries install you can promote the DC to an existing domain using the following PowerShell cmdlets:

Install-ADDSDomainController -DomainName example.local -InstallDns -Credential (Get-Credential domainadministrator)

  • Provide a safemode password as prompted

 

Thanks for reading, I look forward to our next post.

Leave a Reply

Your email address will not be published. Required fields are marked *

4 × two =