Automate Your Lab – Part 3 – DHCP

Table Of Contents

The next step to your automated lab is to set up a DHCP server and to authorize it in your Active Directory. You can customize it completely with variables in the script.


You can define a range for DHCP with tha variables $StartRange and $EndRange. Only IPs in that range will be assigned to machines. I make of use of that feature in order to have some free IPs for my Netscaler SNIP, load balancer and gateways and I don’t have to worry about double assigned addresses. On top I always use because is the default IP of the internal hyper-v network adapter. Follow this tutorial to set up internet access for Hyper-V VMs with an internal switch and NAT.

For the scripts to work I assume that you have a Windows Server 2012 R2 which will be your domain controller, DNS and DHCP Server.

Leave a Reply

Your email address will not be published. Required fields are marked *