This snippet can be used to update each DHCP scope configuration.
$DHCPServer = @('Server1','Server2')
foreach($Server in $DHCPServer) {
# Get DHCP Scopes
Get-DhcpServerv4Scope -ComputerName $Server | % {
# Set DHCP Scope type
Set-DhcpServerv4Scope -ComputerName $Server -ScopeId $_.ScopeId -Type Both
# Get all reservations from scope
Get-DhcpServerv4Reservation -ComputerName $Server -ScopeId $_.ScopeId | % {
# Update DHCP Reservation
Set-DhcpServerv4Reservation -ComputerName $Server -Type Both -IPAddress $_.IPAddress
# Update DHCP DNS Settings for Reservation
Set-DhcpServerv4DnsSetting `
-ComputerName $Server `
-IPAddress $_.IPAddress `
-UpdateDnsRRForOlderClients:$true `
-DeleteDnsRROnLeaseExpiry:$false `
-DynamicUpdates Always
}
}
}
DNS record ownership…
If the DHCP Server should update the DNS record and if this update will fail, then read the article to solve the issue.