Lab Automation with System Center VMM – Part 1 (Creating a VM Template)

So the last few weeks have been fun… Getting sick myself, dealing with family sickness and a rush of projects before the end of the year have left me with little time to work on personal projects. However, I’ve pulled myself together to work another of my project ideas.

Lately, I’ve focused a lot on PowerShell and Configuration Management tools and I haven’t really given System Center much attention. I’ve started to write a Lab automation tool using PowerShell, but my company uses System Center, so I thought I’d look into the suite, primarily SCVMM, for deploying Lab environments internally.

Initially, I thought I would need a combination of the tools to reach my end goal and eventually the project might actually mature into requiring that. However, SCVMM or Virtual Machine Manager actually provided a lot more than I’d imagined without too much work. My goal initially was to deploy a single domain controller on a server 2016 guest and in this post I’ll try and walk you through how I got there. As it’s GUI based, this is going to be more of a step by step guide which I hate, but if you’re interested please bear with me :/. As the setup took me a few nights, I’m going to do this as a series of posts to keep everyone excited. HA…

I’m not going to go through the process of installing Virtual Machine Manager, because its quite simple and there are a lot of good guides online that walk you through the installer. This is the one that I used – here. It goes through the process with 2016 TP4 but the process is the same for 2016 RTM. Note that I’m using Hyper-V as my host (actually nested Hyper-V on my work’s lab host :P). As VMM is a Microsoft product, it heavily integrates with Hyper-V. Having said that it does boast “Multi Hyper-visor support” which at some point I intend to explore further, as we mostly use VMware in house.

Once you have VMM installed and you have your host/hosts connected, the first thing you need to do is create a VM template for the OS you want to deploy. The easiest way to do this is using the VM creation wizard in the VMM console. This is found in the VMs and Services workspace.

1.PNG

Then, if you navigate to your target host under All Hosts > Host Group you will have the option to select Create Virtual Machine on the top task bar.

2.PNG

 

A wizard should now pop up, below is a guide of the options you want to configure:

  1. Create the new virtual machine with a blank virtual hard disk
  2. Next
  3. Virtual Machine Name – eg. “_Server2016_Template_v1”
  4. Gen 1 or Gen 2 (I’m using Gen 1)
  5. Next
  6. Configure your Hardware Settings, you will need to add an ISO to your Virtual DVD drive and connect the guest NIC to your VM Network at this point. Other settings are usually okay left default.
  7. Next
  8. Place the virtual machine on a host
  9. Select your host group
  10. Next
  11. Select your target host
  12. Next
  13. Next
  14. Next
  15. Check the “Start the virtual machine after deploying it” box
  16. Create

On your host, start up the guest VM and install Windows as you would normally. Once Windows is installed, shutdown the guest and reopen the VMM console.

  1. Open the VMs and Services workspace and navigate back to your host group.
  2. Right click the host and select Refresh Virtual Machines
  3. Right click the newly created virtual machine and select Create > Create VM Template

This will open a new wizard for creating your VM Template. The wizard is pretty self explanatory so just “next,next,next” through it and finally create the VM Template.

At this point you will have definitely noticed the Jobs window that is opened when you ask VMM to perform a task. I really like this feature as it allows you to drill down into each step it goes through to perform the task, allowing you to spot exactly when errors occur, if they occur.

Assuming the job is successful, you should now have a new VM template and you can find it in the Library workspace under Templates > VM Templates.

3

With this in place, we can now go ahead an create a new Service Template to deploy our service. Which, I will go through in the next part of this series of posts! Stay tuned for more System Center automation excitingness.

Advertisements
Lab Automation with System Center VMM – Part 1 (Creating a VM Template)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s