PowerTip: Use PowerShell to Get DHCP Server Database Info

Summary: Learn how to use Windows PowerShell to get the DHCP Server database information.

Hey, Scripting Guy! Question How can I use Windows PowerShell to get the database information for a DHCP server if I do not know the name of the server?

Hey, Scripting Guy! Answer Use the ServerName property from the object returned by Get-DHCPServer to get the computer name, then use the Get-DhcpServerDatabase:

Get-DhcpServerDatabase -ComputerName (Get-DhcpServer).ServerName

Note   The DHCP functions come from the DHCPServer module obtained via the RSAT tools for Windows Server 2012.