Scripting DHCP server deployments using netsh in Windows Server 2008 R2

Windows_Server_2008_R2_Logo

Another quick post to show how you can quickly deploy fully working DHCP server with multiple scopes in a matter of seconds. In my case it was a single server with 90 very different scopes and doing this manually would be just soo boring and long that’s unreal. Unfortunately Windows Server 2012 wasn’t an option so no PowerShell love but Windows Server 2008 R2 is still pretty decent and using netsh wasn’t as painful as it seemed. To get us started we need to install the DHCP Server role and start the required service (dhcpserver):

Next step is to authorize DHCP server in the enterprise so we can actually use it to dish out IP addresses:

Other useful commands here would include:

To deauthorize the server –

and to list all authorized servers –


This part should conclude basic setup of DHCP server, time to move on to scopes and other settings.

To add scope named “My DHCP Scope” on 10.10.103.0/24 network you need to run the following (DHCP IP = 10.10.103.186):

Adding IP range (.16 to .250 so you have 234 available addresses) for distribution can be accomplished by:

Adding defuault gateway and two DNS servers as well as DNS search domain:

Specifying lease time (in seconds):

Activating the scope:

That should be it to cover the basics.

Useful link if you guys need to know more about netsh – Netsh commands for DHCP

Leave a Reply