If there is a broken VHD chain (for example the parent VHD was modified, that's why the child no longer mounts), there's a way to fix it by using Hyper-V "Reconnect" feature. How do I do the same programmatically?
Asked
Active
Viewed 145 times
2 Answers
0
I think you want AttachVirtualDisk, but I'm not sure if that's what you are after with regards to VHD chains.

selbie
- 100,020
- 15
- 103
- 173
-
No, Attach actually fails because of broken chain. I need a way to fix it. I tried using SetVirtualDiskInformation, however it doesn't seem to have an option to set the unique identifier. – Isso Aug 26 '18 at 07:27
0
OK found a solution. One needs to open the VHD with OpenVirtualDisk
using OPEN_VIRTUAL_DISK_FLAG_NO_PARENTS
flag. Then call SetVirtualDiskInformation
with SET_VIRTUAL_DISK_INFO_PARENT_PATH
passing the same path as it had before. This will update the parent unique ID and allow to mount the chain.

Isso
- 1,285
- 11
- 23