Author Posts

April 3, 2014 at 3:05 am

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?

April 3, 2014 at 8:51 am

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