How do I create an unattended Windows 8.1 install for building "throwaway" test VMs?

1

I do a lot of software development as a hobby, and in order to test changes, reproduce bugs, etc, I find that I frequently need a clean Windows environment to run my tests.

I can fire up a VM in order to do this, but this typically requires finding the Windows 8.1 ISO, creating a new VM, booting it up, doing the full install (off to look up my "throwaway VM" MSDN key), install all my software, etc. Frankly it's too much work for any but the most significant issues.

I can't just retain a clean snapshot of my VM because I tend to leave the VM un-activated (that's what happens by default anyway, and it's Microsoft's advice for managing throwaway test VMs on MSDN keys) and by the time I next use it, the activation grace period is expired.

What I've thought of doing is creating an automated script to build a new VM, including all my key software, on demand. But most of the deployment automation tutorials I've found (using MDT or sysprep) seem to be targeted at larger-scale deployments. I've tried MDT, but it seems pretty hard to install custom software into the image (for example, the Virtualbox Guest Additions). I've also tried sysprep, but whatever I've done, I still end up needing to manually do some of the install steps.

What is a good way of setting up (and maintaining) a custom install disk and scripts that will let me run an unattended deployment of test VMs reasonably quickly?

(I currently use VirtualBox as my software - I have access to Hyper-V and have been thinking of giving it a try, but I'm not sure if it'll help. The problems I have seem to be more about the unattended install side of things than about creating the VM).

Update A year on, I never really got any closer to a solution. I tried sysprep, but couldn't find a way to manage keeping the image up to date with Windows update, etc (you can only rerun sysprep a certain number of times, AIUI). I tried MDT, but it's way too complicated for my needs.

One alternative option, which I didn't really mention in the original question: I could use one of my MSDN keys to activate my base image, and then clone as needed. Does that work? Specifically, can I clone copies of my base machine "on demand" without invalidating my activation? If I can, then just maintaining an activated base machine for each Windows version I want to use may be a better approach. Are there any pitfalls with this approach that I've not considered? I'd hate to end up invalidating my keys by trying this.

Paul Moore

Posted 2015-06-02T16:03:56.770

Reputation: 573

You create unattended virtual machines the same way you create unattended install for physical machines. What step do you need help with specifically? – Ramhound – 2015-06-02T16:11:39.143

Well, basically, how to start. The MDT documents I've found talk about having 3 or 4 machines involved in the process, and don't really discuss including non-MS software (specifically, VirtualBox guest additions and Python). I tried a simple MDT install on my laptop, and got a cmd prompt, but no task sequence running (I suspect Virtualbox networking not letting the VM see the share on my PC). So how do I run MDT on a single machine, not in a domain, deploying to a Virtualbox VM? – Paul Moore – 2015-06-02T17:20:32.143

Alternatively, is there a better approach for this scenario than MDT? Sysprep seems like an alternative, but I've not used it for some time (and never got a completely unattended install that way, from what I recall). – Paul Moore – 2015-06-02T17:24:06.810

If you are willing to use Hyper-V you can mount the virtual hdd, apply a .wim image to it ( after creating the partition ), then start the virtual machine, with a little work he can make this process nearly automated. – Ramhound – 2015-06-02T17:33:26.650

Answers

0

I think creating a template with sysprep is your best option, but some additional work to create a fully unattended install will be needed.

You can use Windows System Image Manager (part of the Windows Assessment and Deployment Kit which is freely downloadable from Microsoft) to create an unattend.xml which can contain much of the options you normally need to enter manually after a sysprep without the use of a customized unattend.xml. You can even automatically join an active directory domain that way if needed

In the unattend.xml you can also specify a script that will be run at the end which can handle all of the other actions which can’t be set un the unattend.xml.
Experience tells me that an additional script at the end will almost always be needed. I find PowerShell to be a very powerful tool to accomplish this task

Much the same way I’ve created several unattended Windows installations which need but a few clicks to complete. To make the sysprepped image a bit more flexible for future changes you can split the script at the end in two parts

  • First part inside the sysprepped image and called by the unattend.xml which sets the necessary access to the network
  • A second part that is downloaded from the network and run by the first part. This second part can be edited, changed, extended as needed to suit your changing needs without having to recreate your image.

GapWim

Posted 2015-06-02T16:03:56.770

Reputation: 158

0

Back in the XP days, there was a great tool for this called nlite. Its been updated and transformed into ntlite, which will make these slipstreamed isos for you with minimal effort. https://www.ntlite.com

Ryan Gooler

Posted 2015-06-02T16:03:56.770

Reputation: 1 844

0

You can avoid MDT (it is just too complex for your needs) using some other simpler PXE server (i.e. Serva) then use ImgMgr.exe for creating/mantaining the corresponding unattended script Unattend.xml. (I'm related to Serva development but you can do this using some other alternative PXE server if you wish)

Pat

Posted 2015-06-02T16:03:56.770

Reputation: 2 593

-1

If you’re not concerned with updates or testing against various configurations of applications, you can just generalize with Sysprep and create a snapshot or clone from the powered off machine. You can then create a new clone or restore that snapshot whenever you want a fresh environment.

MDT is more complex, certainly, but it lets you deploy up-to-date environments for testing and it allows you to maintain a library of applications that you can select during deployment. For example, if someone tells me they are having an error with Acrobat Reader 9, Java 1.6u17, and Office 2007, I can pick those from a library and have them installed, along with Windows Updates, when I log into the system for the first time to test.

WinOutreach2

Posted 2015-06-02T16:03:56.770

Reputation: 471

This does not really explain HOW to use MDT or Sysprep which the author clearly needs help with. Which is the reason I didn't post an answer, because I am not willing, to submit a full tutorial. – Ramhound – 2015-06-10T16:24:54.940

OP seems familiar with VirtualBox. Sysprep procedure is simple:

  1. Prepare the environment with desired customizations.
  2. Run Sysprep*.
  3. Create clone and/or snapshot.

*Run the command sysprep /generalize /shutdown /oobe or run c:\windows\system32\sysprep\sysprep.exe and select the OOBE, Generalize, and Shutdown options. These are the default options.

For MDT: https://technet.microsoft.com/library/dn744279

– WinOutreach2 – 2015-06-10T16:36:40.297