Automatically bring up a new virtual machine using a sysprep vhd in hyper-v

hyper-vsysprepunattended

i have a VHD which has been sysprepped (it was created on Hyper-V itself), and i have the answer file too generated by sysprep.
now i need to bring up a new VM using Hyper-V which will use the above generated VHD. When i bring up the VM it brings up the UI and expects me to enter the Machine Name and other details. Can't i automate that part and supply the answer file somehow to Hyper-V and it reads values from it and brings up the OS for me?

i saw many links which are suggesting to use SCVMM but i don't have that with me. Can't it do it with Hyper-V alone?

Best Answer

Virtualization environments, like Hyper-V, mostly just create a virtual machine, which is the same as a physical machine with respect to the software running within it. Of course, every virtualization product comes with some set of tools that allow you to affect the software running within the VM.

For guest OS setup, however, Hyper-V offers nothing beyond what you have for a physical machine. Imagine booting a physical machine from a PXE server. You might set up an image on that server and a set of unattend files for various clients. Then the OS you want gets installed on the physical machine when you net-boot it.

The same is true here. You can prep an image to be booted within a VM. But that's no different from prepping an image to boot on physical hardware. Hyper-V has nothing to do with that. It just happens to be stored within a VHD.

SCVMM is a management product that does several things, including prepping images and configuring VMs on Hyper-V servers. If you don't want to use it, that's fine. But don't look to Hyper-V to offer guest OS configuration services. For this, you'll need to treat the guest workload like you would any other machine.

If you want to mount a VHD so that you manipulate the files on it without SCVMM, see this blog entry for sample script code:

http://blogs.msdn.com/b/virtual_pc_guy/archive/2008/02/01/mounting-a-virtual-hard-disk-with-hyper-v.aspx