Windows – Can you use powershell to “spin up” new VM instances

automationhyper-vpowershellwindowswindows-server-2012

Learning powershell and working on creating VMs with Hyper-v. I was wondering is there a way or an ideal way to go about installing/setting up guest operating systems as well with it?

So far the only conclusion I have come up with would be to copy .vhd/.vhdx and attach them to the new VMs. However, I know with *nix this can cause issues with the whole network setup and requires manual fixing but I assume this would be fine Windows wise?

Edit: Yes, I am aware of cmdlets for Hyper-V. That is not what I am asking. Is there a way to install an OS to the newly created VM?

Best Answer

See http://technet.microsoft.com/en-us/magazine/jj933287.aspx for an example of creating a VM and installing an OS from scratch.

The steps are to create the vm, configure the vm, add the source ISO and a floppy with the unmattend.xml, then start the vm

Related Topic