Search code examples
powershellwindows-server-2008dhcp

Can I create dhcp reservation with powershell server 2008 r2


Can I create a dhcp reservation with powershell in windows server 2008 r2?

I can see that they have beautiful cmdlets that are apparently only used on 2012.

Does this mean I would have to do it using netsh, via

netsh dhcp server \\servername scope <subnetID> add reservedip <IPaddress> <MacAddress> "ReservationName" "Comment"

If possible it would be nice to use those new shiny cmdlets

Thanks


Solution

  • Those cmdlets can also be used to manage DHCP server running on Windows Server 2008 or Windows Server 2008 R2, but executed on a machine that supports 'DHCP Server PowerShell cmdlets', for example windows 8, but you cannot run on a Windows server 2008 r2.

    Since DHCP Server WMI provider is not supported on Windows Server 2008 and Windows Server 2008 R2, you need to use –ComputerName while using DHCP PowerShell to manage a DHCP server running on Windows Server 2008 or Windows Server 2008 R2.

    Read this post for a good detailed explanation: Microsoft Technet

    Example

    Add-DhcpServerv4Scope -ComputerName dhcpwin2k8server.contoso.com -Name "Lab-1 Network" -StartRange 10.10.10.1 -EndRange 10.10.10.254 -SubnetMask 255.255.255.0