How to clean up old DHCP server’s entry in a domain via PowerShell and netsh command

It’s very easy to forget old server entries and it may cause an issue in your network.  Sometimes system/network admin wait for approval process or schedule to clean up or just simply don’t know how to.  Whatever your reason is, this should be done to keep your network healthy from any unknown issues.  Here are some ways to clean up, I have listed PowerShell, Netsh and via GUI.

Via PowerShell:

To see list of all DHCP server run PowerShell command:

PS C:\>Get-DhcpServerInDC

To remove it:

You have to be domain or enterprise admin to remove it otherwise, you will get error

PS C:\>Remove-DhcpServerInDC –DnsName YourDHCPserver –IPAddress

This is without error: if you have run as admin

To add it:

You have to be domain or enterprise admin to remove it otherwise, you will get error

PS C:\> Add-DhcpServerInDC –DnsName YourDHCPserver –IPAddress

Using netsh commands

To the list of commands: netsh dhcp list

To add:

Netsh dhcp add server NameOfYourDHCPServer IP address

To delete:

Dhcp delete server NameOfYourServer IP address

Via GUI:

To add:
open your DHCP server, right-click, and select add

To Remove:
open your DHCP server, right-click and select Manage authorized servers …
Then just remove HDCP server that’s no longer in use

That’s it



Leave a Reply