Script to merge a differencing disk into a new parent


  • Can somebody help me with a script (ideally powershell) to merge a differencing disk into a new parent disk?

    I've been trying


    $ims = get-wmiobject -namespace root\virtualization -class Msvm_ImageManagementService

    $ims.mergevirtualharddisk(<"path to diff disk">,<"path to new parent">)

    and keep getting errors like

    'The system failed to merge 'path to diff disk'. Error Code: 2424869


    Failed to open attachment 'path to diff disk'. Error: 'One or more arguments are invalid'

    Host is 2008 R2 SP1


    18 Juni 2012 7:26


  • Hi,

    General speaking, it is recommended that you delete the snapshots in Hyper-V Manager console and then let the system merge the snapshots automatically while the virtual machines is power off.

    By the way, according to the description, it seems that you want to write script. As we mainly focus on the Hyper-V question about Windows Server system and here is not the best support resource for script writing, it is recommend you to get further support in the corresponding community so that you can get the most qualified pool of respondents. Thanks for your understanding.
    For your convenience, I have list the related link as followed.

    The Official Scripting Guys Forum


    18 Juni 2012 13:05