Install DHCP Server Role Using PowerShell

This article has not been completed yet. However, it may already contain helpful information and therefore it has been published at this stage.

I recently had to replace the DHCP service at one of my customers. The customer was still using a solution implemented on a old firewall. Enclosed is the initial situation (see screen below).

# Installing the server role
Install-WindowsFeature DHCP -IncludeManagementTools
# Create DHCP security groups for authorization
Netsh DHCP Add SecurityGroups
# DHCP - Server Restart
Restart-Service DHCPServer
# Authorize DHCP server
Add-DHCPServerInDC
# Showing available Net-Adapter
Get-NetAdapter
# DHCP Netadapter - Binding
Set-DHCPServerv4Binding -BindingState $True -InterfaceAlias "Ethernet"
# Creating a DHCP range
Add-DhcpServerv4Scope -Name <Name> -StartRange <IP> -EndRange <IP> -SubnetMask <SubnetMask>
# Disable Scope
Set-DHCPServerv4Scope -ScopeId <IP> -state Inactive
# Enabling Continuous Dynamic DNS Updates
Set-DhcpServerv4DnsSetting -ComputerName "<Name>" -DynamicUpdates
"Always" -DeleteDnsRRonLeaseExpiry $True
Set-DHCPServerv4OptionValue -OptionID 3 -Value <IP> -ScopeID <IP> -ComputerName <FQDN>
Set-DhcpServerv4OptionValue -DnsDomain <Domain> -DnsServer <IP>
# DHCP-Server Config Backup
Backup-DHCPServer -path C:\BackupDHCP
# Restore DHCP-Server Config Backup
Restore-DHCPServer -ComputerName <Name> -Path C:\BackupDHCP
# DHCP - Server Restart
Restart-Service DHCPServer
# Finishing the DHCP Setup
Set-ItemProperty –Path 
registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ServerManager\Roles\12 –Name 
ConfigurationState -Value 2

References:

Deploy DHCP Using Windows PowerShell
You can use this topic to deploy a Windows Server 2016 Internet Protocol (IP) version 4 DHCP server that provides automatic IP addresses and DHCP options to IPv4 DHCP clients connected to one or more subnets on your network.
DHCP Server einrichten Powershell
In diesem Dokument beschreibe ich die Installation eines DHCP Servers und richte diesen mithilfe der Powershell ein.
DHCP Server deaktivieren
Bei der Migration eines DHCP Servers kommt man irgendwann an den Punkt, an dem man den alten DHCP Server deaktivieren muss. Wie das funktioniert und welche Mög