Do you ever use golden image to deploy virtual machine? I always create golden image and put into VMM Library so i can use VMM to deploy. Now let say, customer is using stand-alone Hyper-V host and do not have VMM and would like to create multiple VM. Then your only options is prepare a golden image and use Convert option in the Hyper-V Manager GUI. Creating a virtual machine is an easy task but it is tedious as you need to go through several step in order to reach to the end result. The pain start when you need to convert to multiple virtual hard disk for VM creation.
Therefore, i can came to an idea to use Powershell in Windows 8 to convert a golden image into 4 Virtual Hard disk and ready for deployment.
1. Create a powershell script and enter the following command
Convert-VHD -Path D:\VMMLibrary\Win2k8R2SP1ServerStandard.vhd -DestinationPath E:\Test1.vhd -VHDFormat VHD -VHDType Fixed -ComputerName node1 |
Above command allow me to create fixed virtual hard disk: Test1, Test2, Test3 and Test4 from golden image which i have prepare earlier.
Command format:-
Convert –VHD –Path (Source) –DestinationPath (Destination) VHD-VHDType (type) –Computername (Hyper-V Host name)
2. Just execute the powershell script and it will help you to convert dynamic disk:-golden image into 4 fixed virtual hard disk and ready to use in your deployment.
The script will convert one disk at a time without your extra effort. (Now i got more excuse to go for coffee break.)
Powershell result:-
I’m getting more excited to use Powershell to make my life as Virtualization Consultant easy .
Next post:-