One-liner: Use Get-ADObject to Find Authorised DHCP Servers

The DHCP PowerShell module has the Get-DhcpServerInDC cmdlet to show you the DHCP servers that have been authorised in Active Directory.

This cmdlet was introduced with Windows Server 2012 and v3 of PowerShell.

What if you don't have access to the above? What if you want to impress your PoSh Chickens and get a list of authorised DHCP servers by using the Active Directory PowerShell module?

What, indeed!

Run this:

Get-Adobject -Filter {objectclass -eq "dhcpclass"} -SearchBase "CN=NetServices,CN=Services,CN=Configuration,DC=halo,DC=net" | Where-Object {$_.name -ne "DhcpRoot"}

 

What ho!