First you need to perform an export though so you have a template to work with. My method for creating a template box?

1. Create a new machine and give it a reasonable amount of cores to work with, at least one NIC, and I don’t recommend less than 6 Gb of RAM if the client is going to be Server 2012 but you can set it to dynamic allocation for thin provisioning.

2. Assign in a new VHD file (I heartily recommend, again, thin provisioning and using Dynamically Expanding VHDs) and give it a reasonable amount of storage (at least 30 GB for a server 2012 system drive, in my case I give my systems 50 Gb to start with). If your business is anything like ours, the devs usually like to have a secondary drive as well for data storage. So if that is a case, create and attach another dynamically expanding VHD.

3. Insert the Server 2012 ISO disk and do an install. Connect the machine to the internet, and start the long process of downloading and installing updates (this is the last time you will ever have to start from scratch!). You can go ahead and activate your Server 2012 license on the box as well (we can change this on each copied machine we we re-deploy). If your servers ALWAYS come with some base software (Google Chrome, Notepad++, 7zip, whatever…) go ahead and get that installed as well.

Don’t forget to keep the local admin password you create in a safe place! You will need it for every subsequent machine you create from this template.

4. For our environment I also did several other things like flipping on RDP access, configuring security software, the firewall, and modifying local accounts.

5. Don’t join the box to your domain! Not yet! – I did go ahead and change the computer name around on my box, though not necessary.

6. The LAST thing I do on my template machines, is go into network manager in Windows and disable the NIC card. Because when I copy this box I don’t know what the Copy’s intended IP configuration is going to be and when I bring the copy up I don’t want to create IP conflicts on the network.

7. When it is all said and done, you should have this lovely, pristine, box that is not domain joined and has its NIC card disabled.

8. In Hyper-V manager, you might want to name it something descriptive like “Server 2012 Template”. The name of a VM in Hyper-V manager has no bearing whatsoever on the actual windows “computer name” or the domain object it creates. It is only for Hyper-V manager usage.

9. Shut the box down, right-click it in Hyper-V manager and from the context-menu choose “export”

10. I created a folder on a secondary drive on my Hyper-V host machine to store all of my exported template servers. Do whatever you need to do to stay organized. Exporting takes a little bit of time (as does importing). The bigger the VHD files, the longer, so keep your templates fairly lean if possible but put as much into them as you can as the idea is to save yourself from “manual labor” :). Importing takes less time, at least in my case, than manually configuring.

11. One other note, you don’t need to create a new folder for each export. You just need one base folder. When you perform the export, Hyper-V Manager automatically create a “root folder” in your chosen destination that is named the same as the VM name in Hyper-V. All of the export files for that export go into that folder. Microsoft is seemingly inconsistent with Hyper-V in how they handle folders so I tend to forget this and manually create a separate folder for a new export only to find myself, annoyingly enough, with a single folder nested inside of a single folder in my root templates folder…

Excellent… you should have a folder on your system now that is storing your template box.

I used to do all of the above by simply copying and pasting VHD files around. This is a quick method, of sorts, but quite dirty and creating a new machine using a VHD is more work than importing an entire box. I think exporting/importing is a better way to go about things…

This post has no comments. Be the first to leave one!

Join the discussion

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