On a recent project, the customer needed a way to document their DHCP configuration after losing the DHCP database on one of their DHCP servers. I offered to create a script and they gave me permission to do so. Microsoft makes DHCP cmdlets for Windows Server 2012 and higher. The customer had a 2012 DHCP server that was not in production so I used that to create the initial script. They did not have a Windows 8.x computer for me to use so I had to use Microsoft Notepad on the DHCP server to create the script. After creating the initial script, I sent out a request for testers and added a lot more functionality to the script. I received a lot of requests from people wanting to test the script and these people offered a lot of suggestions and enhancements.



Before I get started listing all the features, I want to start by thanking a dedicated and hardworking group of testers and others who provided PowerShell help and guidance for developing this script. This is the list of testers who gave me permission to use their names.

Aaron Parker

Andrew S. Baker

Charles Polisher

Daniel Chenault

David McSpadden

Duy Le

Glen Thompson

Jorge De Almeida Pinto

Kevin James

Martin Therkelsen

Paul Loonen

Roy Textor

Ryan Revord

Samuel Legrand

Timothy “Big Kahuna” Mangan

Tyson Leslie

The customer’s original DHCP server that had the database issue was running Windows Server 2003. When I found the PowerShell cmdlets for DHCP, I saw there were Export and Import cmdlets. But when I tried to run the Export cmdlet against the 2003 server, it did not work.

What I found out was that the netsh command worked from Windows Server 2000 all the way up through Server 2012 R2 and is much faster than PowerShell. The PowerShell Export/Import works on Windows Server 2008 and higher but I prefer the netsh commands.

netsh dhcp server export c:\dhcpexport.txt all netsh dhcp server import c:\dhcpexport.txt all

The script documents every nook and cranny of both IPv4 and IPv6 that I can find a way to document using PowerShell. Version 1.0 of the script will create a Word, PDF or Formatted Text document named after the DHCP server. For example, 2003DHCP_DHCP_Inventory.docx (or .PDF or .TXT). If the server name is entered as localhost or an IP address, the script will attempt to resolve those to the actual server name. A future update will add an HTML output option.

The following items are documented:

DHCP Server Information IPv4 Properties General DNS Netword Access Protection Filters Failover Advanced Statistics Superscopes Scopes Address Pool Address Leases Reservations Scope Options Policies DNS Failover Statistics Scopes Address Pool Address Leases Reservations Scope Options Policies DNS Failover Statistics Multicast Scopes General Lifetime Exclusions Address Leases Statistics BOOTP Table Server Options Policies Filters Allow Deny IPv6 Properties General DNS Advanced Statistics Scopes General DNS Lease Address Leases Exclusions Reservations Scope Options Statistics Server Options



Please let me know if I missed documenting any DHCP feature or if something is not documented properly, especially in the IPv6 section.

NOTE: All scripts are continually updated. You can always find the most current versions by going to https://carlwebster.com/where-to-get-copies-of-the-documentation-scripts/

Thanks

Webster