viernes, 25 de marzo de 2011

Scripting out DHCP reservations in Windows Server 2008 with Netsh

http://www.techrepublic.com/blog/datacenter/scripting-out-dhcp-reservations-in-windows-server-2008-with-netsh/396

July 21, 2008, 6:00 AM PDT

Takeaway: Scripting out DHCP reservations can save a lot of time for large pools of reservations. See how the Windows Server 2008 Netsh tool can help out in this regard.

Scripting out DHCP reservations can save a lot of time for large pools of reservations. See how the Windows Server 2008 Netsh tool can help out in this regard.

——————————————————————————————————————-

Netsh is one of the most powerful Windows networking tools in the pre-PowerShell era. For Windows Server 2008, Netsh adds new contexts and expands some of the existing functionality introduced in Windows 2000.

One use of Netsh includes some management of DHCP scopes to modify reservations. An area in which this can be very useful is to script out a large batch of reservations for a number of virtual machines for a server subnet or a test scenario. On a Windows Server 2008 system running DHCP, this is the scripted out command to make or modify a reservation:

netsh dhcp server dc1 scope 192.168.1.0 add reservedip 192.168.1.189 080027C591F9 XVM1.WS2K8.DEV

In this example, the DHCP server name and scope are populated, as well as the desired IP address, the MAC address, and the DNS domain name of the system for the reservation. Once the command is entered, Netsh interacts with the DHCP service on the server to make the appropriate reservation to the scope. Figure A shows the command entered successfully.

Figure A

Figure A

If an existing reservation needs modification, the existing entry should be sent a sequence of commands that delete the existing reservation and then add the new one. Here’s an example:

netsh dhcp server dc1 scope 192.168.1.0 delete reservedip 192.168.1.189 080027C591F9
netsh dhcp server dc1 scope 192.168.1.0 add reservedip 192.168.1.181 080027C591F9

Netsh finesse can enable many tasks to be completed quickly. Plus, being able to modify many DHCP reservations in a scriptable fashion can save a lot of time during a large scope modification or creation.

For more about Netsh, check out my post: Creating port policies in Windows Server 2008 with Netsh.

No hay comentarios:

Publicar un comentario