In the modern environment where one should be using VMs for everything we find ourselves wanting to save on disk, memory and CPU usage wherever we can. To this end, many of us may choose to set up our Windows servers in a headless configuration (Windows Core). According to Microsoft’s own documentation, this can save as much as 4GB of disk space alone. Outside of doing this to force yourself to learn PowerShell, this isn’t terribly useful for a single server however if you have many Windows 2016 servers this can start to add up rather quickly. As you gain more servers this reduction and the need to use PowerShell to automate tasks becomes more and more important.
I’m going to start assuming that you’ve already installed Windows Server 2016 with or without the full GUI.
Note: If you are using Windows Server 2016 Core you will need to open a PowerShell console each time the system boots by typing `powershell` at the console after you log in. If you have the full GUI then you will need to start PowerShell as well, I encourage you to Right-Click the Start Menu and choose PowerShell.
The first thing you need to do is to setup a static IP address for your DC. To do this you need to know the name of the interface to your local network.
This should list all of your network interfaces, find the correct one for your server/network and take note of its `InterfaceAlias` this is the name of the adaptor. In my case, my Servers are in the 10.0.50.0 – 10.0.50.63 range (/26) this new server will be 10.0.50.18 and the adaptor that the server will use on the internal network is known as “Ethernet0”.
New-NetIPAddress -Interface “Ethernet0” -IPAddress “10.0.50.18” -PrefixLength 26 -DefaultGateway “10.0.50.0”
Now set the name of the system, in my case, this will be DC02 and its FQDN will be DC02.example.com
Rename-Computer -NewName “DC02”
If you have an existing domain, it is easier at this stage to join the new server to the domain then to make it a DC. The Server parameter is optional in this command but if you need for any reason to specify the server to use do it here.
Add-Computer -DN internal.example.com -Server dc01.internal.example.com
Now you should be able to see this server if you have a look in Active Directory Users and Computers, however, it’s not in the Domain Controllers OU because it isn’t yet a Domain Controller. Before we can do that, however, we need to add the Active Directory Domain Services role to this server.
Add-WindowsFeature -name AD-Domain-Services
Now that we have ADDS install we can make this server a DC!
Install-ADDSDomainController -DomainName “internal.example.com” -Credential (Get-Credential)
This will prompt for your username and password, the user you use here must have Enterprise Admin (or possibly have the required roles delegated?). Over the next few minutes, depending on the size of your domain/forest, the new DC will sync with the master. Once the sync is done the DC should be up and ready for use.