After compacting the VHD for one of my virtual machines, I saw this error while trying to restart the machine:
An error occurred while attempting to start the selected virtual machine(s).
Account does not have permission to open attachment ‘D:\Directory\Data.vhd’. Error: ‘General access denied error'(0x80070005). (Virtual machine ID F4076715-AF1E-414C-BEB9-28D67B97E20F)
Of course I was taken aback, because I hadn’t changed any permissions on the file, I just compacted it. Though in the act of compacting the system probably created a new file, then deleted the old one and renamed the new one. So I went searching on Google for some kind of answer.
This page was the one that set me on the right course. The simple answer was to give Full Control to the Users group on the file. After that the virtual machine started with no problems. My other VHDs don’t have Full Control for the Users group, they only have Read and Execute. But they do have Read and Write permissions set for a special user, F4076715-AF1E-414C-BEB9-28D67B97E20F. Notice this is the same user that was mentioned in the error message. I couldn’t find an easy way to add that user to the VHD in question, though, so I gave all users Full Control instead, and I’m trusting that there shouldn’t be any consequences to that down the road.