DHCP Server DNS Updates

Written by Arne Tiedemann on Tuesday August 13, 2019

If you use a Microsoft DHCP Server with many scopes and you have to check each scope configuration.....

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.

https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/dd334715(v=ws.10)