Setting Up Active Directory, DNS, and DHCP on Server Core using PowerShell

Since Windows Server 2016 Insider Build is free with full licenses, why not using it? But it’s only available in Server Core, which means I will have to use PowerShell to do all the work. I am setting up one that is the first server in a test environment and I need it to be the AD server as well as DHCP. DNS will be added automatically during the AD installation.

Here are the basic steps to get started.

Get the server ready

That includes

  • Setting up network settings with a static IP for the server;
  • Assigning a meaningful NetBIOS name (ComputerName);
  • Install all updates to keep the system up-to-date;
  • Activate the Windows Server installation;

You can use either the PowerShell cmdlets such as New-NetIPAddress and Set-DNSClientServerAddress to make these changes or the Server Core built-in tool sconfig.exe if you would like something easier.

SConfig

Install Active Directory service

Start with

Install-WindowsFeature -Name AD-Domain-Services

to install the Active Directory server role. No restart needed.

And then

Install-ADDSForest -DomainName test.local

to install the first Forest with the name test.local. You will need to provide the safemodeadministratopassword and confirm the server to be configured and rebooted afterward along the way. Note that the DNS server will be installed and properly configured automatically during the process.

Once rebooted, use DCDiag to verify the new Domain Controller and make sure the AD and DNS services are running and sysvol and netlogon shares are properly configured.

Check AD services and shares

Now let’s add a first user account using

New-ADUser -Name kent -AccountPassword(Read-Host  -AsSecureString "AccountPassword") -PassThru | Enable-ADAccount

Type in the password twice and it’s all set. And then use

ADD-ADGroupMember

to add the newly created user to the group you would like, such as Administrators group.

Install DHCP service

Start with

Install-WindowsFeature -Name DHCP -IncludeManagementTools

Server 1 on TEST2016 Virtual Machine Connection 2018 01 23 10 52 45 600x204 - Setting Up Active Directory, DNS, and DHCP on Server Core using PowerShell

And then use

Add-DHCPServerv4Scope -Name "Internal" -StartRange 192.168.30.51 -EndRange 192.168.30.100 -SubnetMasking 255.255.255.0 -State Active

to add a new DHCP scope and use

Set-DHCPServerv4OptionValue -ScopeID 192.168.30.0 -DnsDomain test.local -DnsServer AD-IP -Router IP-of-Router

to set up the DHCP options.

Final step, use

Add-DHCPServerInDC -DnsName test.local -IPAddress IP-of-DC

to authorize the DHCP server to operate in the specified domain.

To verify, use Get-DHCPServerInDC.

Verify DHCP authorization - Setting Up Active Directory, DNS, and DHCP on Server Core using PowerShell

That’s about it, enough to get a working Domain powered environment.

Leave a Reply

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