Dear my readers,

As stated in a previous blog, there is three main types of the disks.

the Child and parent disks where you can have some sort of base disk contains all sysprepped image of the windows and another child disk contains the currently running system like base for windows 2003 sp2 and multiple child disks contains different applications

anyway what I am trying to address is when you move your parent files to another directory and try to open the child VHDs in your VMs you will get a message in Virtual PC saying please locate your Parent disks, but if you are using HyperV you will get error message which says you cannot start the machine due to disk failure….

You can use the WMI to connect back your Child disk with the parent in the new location

we will declare variable for the wmi class we working with.

$vhd=gwmi Msvm_ImageManagementService –namespace rootvirtualization –comp $computer

we will define the disks as variables

$child=c:vhdschild.vhd

$parent=c:vhdsparent.vhd

we will define the computer we are trying to connect to in the $computer variable; if it localhost we will use “.” dot if it is remote we will use the accessible hostname or netbios name.

$computer=.

now it is ready to use our method ReconnectParentVirtualHardDisk which help us the solve the problem stated above, as we learnt before that if we want to know how to use certain method then we use get-member and look for the syntax in the definition

$vhd |gm ReconnectParentVirtualHardDisk |fl

TypeName   : System.Management.ManagementObject#rootvirtualizationMsvm_ImageManagementService
Name       : ReconnectParentVirtualHardDisk
MemberType : Method
Definition : System.Management.ManagementBaseObject ReconnectParentVirtualHardDisk(System.String ChildPath, System.String ParentPath, System.Boolean Force)

so now we will connect the child to new parent.

$vhd.ReconnectParentVirtualHardDisk($child,$parent,1)

Mahmoud Ibrahim (admin)

About the Author

Mahmoud Ibrahim has technology experience with over 18 years of IT industry. He'd worked in many organizations in many roles and expanded his knowledge across technology stacks, and he is enjoying sharing his expertise whenever possible :).
He is working as a presales expert in Micro Focus serving the international community.

View all posts by Mahmoud Ibrahim (admin)
Previous Article
Next Article