Setup first Domain Controller using Powershell

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:

https://onkelx.nl/2017/07/28/network-and-hostname-configuration-using-powershell/

 

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.

Install-WindowsFeature AD-Domain-Services

 

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.

Example:

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.

Example:

Set-DnsServerForwarder -IPAddress 8.8.8.8,8.8.4.4

 

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:

https://onkelx.nl/2017/07/28/install-and-configure-active-directory-certificate-authority-using-powershell/

If you want to install DHCP on the Domain Controller using Powershell, use this tutorial:

https://onkelx.nl/2017/07/28/dhcp-server-installation-and-configuration-using-powershell/

 

2 thoughts on “Setup first Domain Controller using Powershell

  1. PS C:\Users\Administrator> Install-ADDSForest -DomainName “Testlab2016.local” -DomainMode 7 -ForestMode 7 -InstalDns:$tr
    ue -NoRebootOnCompletion:$false
    Install-ADDSForest : A parameter cannot be found that matches parameter name ‘InstalDns’.
    At line:1 char:80
    + … e “Testlab2016.local” -DomainMode 7 -ForestMode 7 -InstalDns:$true -N …
    + ~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [Install-ADDSForest], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.DirectoryServices.Deployment.PowerShell.Commands.Instal
    lADDSForestCommand

    Solved Error in Example ( -InstalDns:$true ==> -InstalLDns:$true)

Leave a Reply

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