This tutorial shows you how to setup the first Domain Controller (new AD DS Forest) using Powershell. For this tutorial, Windows Server 2016 Standard Edition without Desktop Experience has been used. This edition was known as Core Edition in previous Windows Server editions.
Additionally, install a Certificate Authority, Certificate Authority Web Enrollment or DHCP service on the server.
To configure the network adapter and change the hostname using Powershell, use this tutorial:
Log in as Administrator. A Command Shell is shown. Type ‘powershell’ and hit enter.
To install the Active Directory Domain Services, use the Install-WindowsFeature cmdlet.
Create the first domain, also called the root-domain. The name of the root-domain will also be the name of the Forest. For example, create a domain called “lab01.local”, automatically install DNS, set the Domain- and Forest Functional level to Windows Server 2016 (7) and reboot the server after the installation.
Install-ADDSForest -DomainName "lab01.local" -DomainMode 7 -ForestMode 7 -InstallDns:$true -NoRebootOnCompletion:$false
After the reboot you have a fully functional domain controller.
Because the domain controller is also DNS server, you might want to set DNS Forwarders. Use the Set-DnsServerForwarder cmdlet to set the forwarders. For example, use the Google DNS server addresses, or any other public DNS server address.
Set-DnsServerForwarder -IPAddress 220.127.116.11,18.104.22.168
You have completed your first Domain Controller installation using Powershell!
If you want to install a Certificate Authority on the Domain Controller using Powershell, use this tutorial:
If you want to install DHCP on the Domain Controller using Powershell, use this tutorial: