powershellnetwork-programmingcmddhcpipconfig

Get DHCP Server address with only Powershell, like ipconfig /all


Get-NetIPConfiguration doesn't show DHCP server's ip address information. How can I do same as ipconfig /all but with PowerShell native tools?


Solution

  • Use this :

    Get-CimInstance Win32_NetworkAdapterConfiguration -Filter "DHCPEnabled=$true" | Select DHCPServer
    

    if you use Windows 7 / 2008 R2 or below :

    Get-WMIObject Win32_NetworkAdapterConfiguration -Filter "DHCPEnabled=$true" | Select DHCPServer
    

    Both will retrieve only interface with DHCP enabled, remove the filter if you want them all