Server 2016: Install Active Directory Domain Services Using PowerShell

This blog post explains how to promote Windows Server 2016 to Domain controller. First, you need to check if your server is up to date. Please read this article.

Build Your Domain Controller

Let’s start by renaming your server with rename-computer cmdlet:

PS C:\Users\Administrator> $newname = “DC1”
PS C:\Users\Administrator> Rename-Computer -NewName $newname -force
WARNING: The changes will take effect after you restart the computer WIN-ORHN7R89G82.

Next, add the RSAT and Active Directory Tools. When it’s done, restart the server:

PS C:\Users\Administrator> $addsTools = “RSAT-AD-Tools”
PS C:\Users\Administrator> Add-WindowsFeature $addsTools

Success Restart Needed Exit Code      Feature Result
------- -------------- ---------      --------------
True    No             Success        {Remote Server Administration Tools, Activ...


PS C:\Users\Administrator> Restart-Computer

Just check the new name:

PS C:\Users\Administrator> hostname
DC1

Great! Now we can install the ADDS role. Don’t forget to include the IncludeManagementTools parameter:

PS C:\Users\Administrator> Add-WindowsFeature -Name “ad-domain-services” -IncludeAllSubFeature -IncludeManagementTools

Success Restart Needed Exit Code      Feature Result
------- -------------- ---------      --------------
True    No             Success        {Active Directory Domain Services, Group P...

Add the DNS role:

PS C:\Users\Administrator> Add-WindowsFeature -Name “dns” -IncludeAllSubFeature -IncludeManagementTools

Success Restart Needed Exit Code      Feature Result
------- -------------- ---------      --------------
True    No             Success        {DNS Server, DNS Server Tools}

Everything is ok, we can deploy Active Directory:

  • Set the DomainMode parameter equals to 7 (it means Windows Server 2016 level).
  • Do the same thing for ForestMode parameter.
PS C:\Users\Administrator> Install-ADDSForest `
 -CreateDnsDelegation:$false `
 -DatabasePath "C:\Windows\NTDS" `
 -DomainMode "7" `
 -DomainName "get-cmd.Local" `
 -DomainNetbiosName "get-cmd" `
 -ForestMode "7" `
 -InstallDns:$true `
 -LogPath "C:\Windows\NTDS" `
 -NoRebootOnCompletion:$false `
 -SysvolPath "C:\Windows\SYSVOL" `
 -Force:$true

Note: If you are in a production environment, I don’t recommand to deploy the NTDS Database on the same partition as Windows. Add another partition such as “D:\Windows\NTDS”.

Your server will reboot. To finish, you can check your Active Directory:

ad2016

 

 

Thanks for reading! You can follow me on Twitter @PrigentNico

About Nicolas 282 Articles
I work as an IT Production Manager, based in Paris (France) with a primary focus on Microsoft technologies. I have 10 years experience in administering Windows Servers. . I am a Microsoft MVP for Cloud & Datacenter Management. I also received the PowerShell Hero 2016 award by PowerShell.0rg. And finally, I am "MCSE: Cloud Platform and Infrastructure", "MCSA: Windows Servers", "Administering & Deploying SCCM", and CheckPoint CCSA certified.