Insufficient data from Andrew Fryer

The place where I page to when my brain is full up of stuff about the Microsoft platform

Lab Ops – part 1 Introduction

For some people building demo setups is a part of the job,  for example Trainers pre-sales Technical roles and evangelists like me.  Everything shifts as these evolve for example

  • a beta product comes out and we need to show new concepts that the technology introduces, for example software defined networking in Windows Server 2012 R2
  • Then as the product matures we need to show this in context of performance and scale, as well as how high availability is affected and how it interoperates with other solutions
  • We also need to show how to migrate onto the new solution and how to retire the legacy version.

Typically a product even an operating system doesn’t live in isolation and all of this means that new setups need to be continually created.  So the trick is to have a framework to build from rather than a set of virtual machines that get modified checkpointed and so on.  This really hit home to me when I was trying to set up a VDI environment recently as my deployment and desktop wingman Simon May is off to a new role in the USA and my usual hack and slash approach to VMs wasn’t working.

I was chatting over my problems with Marcus Robinson of Gold Partner Octari at the Virtual Machine User Group in Manchester, and he showed me his PowerShell! Marcus was up til 4am preparing for a course and had developed a  script on the back of something developed by MVP and certified trainer, Thomas Lee, whose scripts are published on  My approach was flawed because I was booting up a generic sysprepped VM which while it was joined to the domain had a random name as you can set this in an unattend file.  This meant I couldn’t easily persist a session in PowerShell to rename the VM in Active Directory and the VMs have dynamic IPs as well.   The “Lee-Robinson” approach I picked up  is really clever and works as follows:

1. Use Windows install media to create a sysprepped Virtual Hard Disk (VHD) using the publicly available WimtoVHD Powershell script

2. Modify an unattend.xml file to contain the post sysprep configuration  you need, by injecting xml code in fr such things as the ip address and domain name and credentials to join the domain.

3. mount the newly created VHD and inject the unattend.xml file into [mounted drive letter}:\windows\system32\sysprep

4. unmount the drive

5. create a VM around the new VHD

6. start the VM

Thomas and Marcus need to do this so they can set up a lab environment for each student or each pair of students on a series of hosts, in Marcus’s case he needed to build a lab to show off Data Protection Manager, while Thomas is constantly pushing PowerShell itself as well as needing to run labs of his own.  I see the other advantages of this approach to a lab

  • Paying for license keys isn’t a problem –VMs are just kept alive for a demo  and most Microsoft evaluation keys are good for 180 days.
  • keeping snapshots of VMs in synch can be problematic for example domain trusts and DNS can get confused which leads to most of the problems you might have seen in my demos last year.
  • The resources I need to keep are just some scripts, databases and possibly some certificates.
  • I can adapt the scripts to work on Azure and have some of my stuff deployed there if I can rely on internet connectivity at an event.
  • I get sharper at deployment and PowerShell, both of which are useful skills anyway.

This all seems such a good idea I thought I would do more posts on this in a series as I reset my demos for the next round of events I have been asked to do.

Finally if you want a proper deep dive into PowerShell this is not the blog you are looking for and you could do worse than hang at one of Thomas’s PowerShell camps at the time of writing the next one is 19th October 2013.