Use PowerShell to Install a DHCP Server on a Windows Server 2019 (Server Core) Active Directory Domain Controller
You need to have an Active Directory domain in place. I'm picking up where I left off in my previous blog article Use PowerShell to Create a New Active Directory Forest on Windows 2019 Server Core Installation (no-GUI).
The procedure shown in this blog article is for demonstration purposes only.
Install the DHCP server feature.
1Install-WindowsFeature -Name DHCP
Add the DHCP scope to the server.
1Add-DhcpServerv4Scope -Name '192.168.129.x' -StartRange 192.168.129.101 -EndRange 192.168.129.199 -SubnetMask 255.255.255.0
Options can either be set at the scope level.
1Set-DhcpServerv4OptionValue -ScopeID '192.168.129.0' -DNSServer 192.168.129.100 -DNSDomain mikefrobbins.com -Router 192.168.129.1
Or at the server level.
1Set-DhcpServerv4OptionValue -DNSServer 192.168.129.0 -DNSDomain mikefrobbins.com -Router 192.168.129.1
Authorize the DHCP server.
1Add-DhcpServerInDC -DnsName dc01.mikefrobbins.com
Display information about the scope.
1Get-DhcpServerv4Scope | Select-Object -Property *
Warning: Do NOT connect a DHCP server to your production network without explicit permission from your corporate network team
.
The procedure shown in this blog article was deployed to an isolated Hyper-V internal network in a test lab.
µ