In Part 1, we have covered on using Convert-VHD Powershell command to convert multiple Dynamic Disk Golden Image to Fixed Disk. Thanks to Eric, he has highlighted a simpler way to achieve the same scenario with the combination of using Foreach-Object and Convert-VHD. Here is the command to share with the rest of people:
(1..4) | Foreach-Object { Convert-VHD -Path D:\VMMLibrary\Win2k8R2SP1ServerStandard.vhd -DestinationPath “E:\Test$_.vhd” -VHDFormat VHD -VHDType Fixed -ComputerName node1 } |
Explanation
“(1..4)” creates an array 1,2,3,4. The Foreach-Object cmdlet will then run four times and “$_” will have the value of 1 on the first round, 2 on the second, and so on.
Today, I've learn something new and more coffee break time. :)
Previous post:-