Create a VM in Hyper-V using existing VHD or VHDX file with different VM Size

Hello All,

I am looking for the script to create Hyper-V VM with different memory , cpu and hard disk using existing VM which is running in Hyper-V and in .VHD and .VHDX format. Please help me with the pointers.

@habeeran Welcome to PowerShell community. I would suggest that you have to get your hands dirty with Hyper-V cmdlets. If you have never wrote a PowerShell script, first you have to start learning it as it will help you throughout you career. You can search for Hyper-V cmdlets in PowerShell which is enough for your requirement. But you need some basics to put them together to make a script. You wont get a ready made script from Forums. If you can start with some code, we are here to help you out.

It’s a simple task of creating and template/guest as normal, create and new guest off that template then modify the new guest.
All the settings are just XML files.

See also

AutomatedLab 5.7.0 The module creates a Hyper-V visual lab automatically as defined in the XML files.

Hi Harikrishna, You can’t create a VM from the existing VHD or VHDX unless it is already sysprep’ed, for windows vms follow this link…

For Linux, there are various options available, just google it and follow as needed.

And as @kvprasoon mentioned, please come up with some script, then somebody from the forum will definitely help you out.

Thank you.