Get-DhcpServerv4Lease cmdlet returns error

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

  • Author
    Posts
  • #14291

    Sunil Padmanabhan
    Participant

    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 xxx.xxx.xxx.xxx

    I get below error
    Failed to get leases from scope xxx.xxx.xxx.xxx 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
    Moderator

    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 xxx.xxx.xxx.xxx 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: http://gallery.technet.microsoft.com/scriptcenter/05b1d766-25a6-45cd-a0f1-8741ff6c04ec

You must be logged in to reply to this topic.