Get-DhcpServerv4Lease cmdlet returns error

This topic contains 1 reply, has 2 voices, and was last updated by  Dave Wyatt 4 years, 2 months ago.

  • Author
  • #14291

    Sunil Padmanabhan

    My Windows 2012R2 Server running powershell is a memberserver, the DHCP Server is a Windows 2003 Server

    I tried running below command
    Get-DhcpServerv4Lease -Computername DHCPSERVERNAME Scope

    I get below error
    Failed to get leases from scope from DHCP Server
    Fully Qualified Error ID: Win32 1745,Get-DhcpServerv4Lease

    Is this because this cmdlet is not fully compatible with Windows 2003 Server. If yes, is there a workaround?

  • #14308

    Dave Wyatt

    That's one of the CIM cmdlets that were added in Windows Server 2012; they can't be used to manage downlevel DHCP servers, because the necessary WMI namespaces / classes don't exist on older operating systems.

    For older computers, netsh.exe offers quite a bit of functionality (though it'll be giving you text instead of objects.) For example:

    netsh dhcp server \\DHCPSERVERNAME v4 scope show clients

    I haven't tried it, but a web search turned up a PowerShell module that is a wrapper around netsh, which might help you with parsing the text and working with objects:

You must be logged in to reply to this topic.