Take the 2-minute tour ×

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?

share|improve this question

3 Answers 3

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:


share|improve this answer
thanks jake, that does help but doesn't answer my original question of how do i point it to an unattended file, so that i don't have to manually enter the machine name when the VM comes up. If Hyper-V doesn't have that option at all, i will mark yours as the answer.. if it does can you add that too? –  Anirudh Goel Feb 21 '12 at 4:02
Again, Hyper-V has nothing to do with that. Do it as you do it for a physical machine. (I'm not a wizard with unattend files. I simply don't know how that's done. I do know it has absolutely nothing to do with Hyper-V.) –  Jake Oshins Feb 21 '12 at 7:23

I've never tried this before but I can think of 2 options.

  • If you have an answer file, you should be able to automate setting everything you needed to enter manually. Before the VM creation, mount the VHD on the host machine, edit the answer file (e.g. change the host name in it), unmount the VHD and create VM from it.

  • You can also have a script file running in the VM when it boots up for the first time after OS installation which reads configuration data via Data exchange service and actually does the configuration. Data exchange service is automatically turned on by default. When you edit the specific registry keys on the host machine, they will show up on the corresponding registry keys on the VM.

share|improve this answer

Well, here users separate from admins. Admins are used to script.

PowerShell can be used to control Hyper-V - there are cmdlets downloadable for stuff that is not yet there (Hyper-V API is quite arcane without them). THe rest is a junior admin training exercse to write a script to read the answer file and configure the hypervisor. THAT SAID - obviously it can not easily access an ansqwer file embedded on the vhd itself. And moving the answer file into hyper-v is another complex issue, for which I would seriously tell you to at least check out SCVMM.

Note: Thsi is Hyper-V alone as long as you consider PowerShell to be available - and PowerShell is part of windows core functionality these days.

share|improve this answer
I don't think his question had anything to do with Hyper-V. I think he question is, more or less, "How do I make a sysprepped image use an answer file?" His image just happens to be in a VM. –  Jake Oshins Feb 20 '12 at 16:57
Ah, no - see, he says explicit how to configure hyper-v dialogs. I dont tryto guess what people with a screwed mind MAY think, I answer the question that is there. Stuff like hyper-v level machine name isa hyper-v configuration. –  TomTom Feb 20 '12 at 17:23
i am an admin, and have powershell access too. i can take out the answer file out of the VHD, but still want to know if there is a supported way to tell hyper-V, hey use this VHD and take this answer file, when the windows dialog pops up fill the values using this file. Now i am comfortable if it is through a PS1 script, or an option like attaching a floppy to the hyper-V system. But don't want trouble of SCVMM –  Anirudh Goel Feb 20 '12 at 18:00
I still don't think that this question has anything to do with Hyper-V. It seems like you're trying to set up a system image. You do that by using the unattend file, just like you would with a physical machine. Are you asking how to mount the VHD file so that you can put the unattend file on it before booting it? Or are you asking how to mount a virtual floppy with the unattend file? –  Jake Oshins Feb 20 '12 at 18:11
Well, he says hyper-v, he talks about hyper-v dialogs. Sorry, you want to bother me with thoughts obviously contrary to the question my hourly rate applies. –  TomTom Feb 20 '12 at 18:22

Your Answer


