Resolved: Hyper-V General access denied error when trying to load a Virtual Hard Drive

Resolved: Hyper-V General access denied error when trying to load a Virtual Hard Drive

Recently I was working with my VMs and moving their storage files from one location to another. I don’t recall exactly what I did that caused this issue but I was unable to start my VM. I would get every time the following error message:

Hyper-V Manager

An error occurred while attempting to start the selected virtual machine(s).

‘VMName’ failed to start. (Virtual machine ID ‘SomeID’)

‘VMName’ Microsoft Emulated IDE Controller (Instance ID ‘SomeID’): Failed to Power on with Error ‘General access denied error’ (0x80070005). (Virtual machine ID ‘SomeID’)

‘VMName’: IDE/ATAPI Account does not have sufficient privilege to open attachment ‘C:\Users\Public\Documents\Hyper-V\Virtual hard disks\DiskName.vhdx’. Error: ‘General access denied error’ (0x80070005). (Virtual machine ID ‘SomeID’)

‘VMName’:  Account does not have sufficient privilege to open attachment ‘C:\Users\Public\Documents\Hyper-V\Virtual hard disks\DiskName.vhdx’. Error: ‘General access denied error’ (0x80070005). (Virtual machine ID ‘SomeID’)

The Problem

Not sure what originates this issue, but as the error message indicates Hyper-V does not have enough permissions (/sufficient priviledge) to open the attached hard drive. If I open a Virtual Machine Disk of a VM that works I can see there is an account on the Security settings tab that looks like virtual machine ID. When I go into the VHDX file for the one that is not working I can see it only has the standard accounts that are inherited by the parent folder. Clearly at some point the file permissions were lost, hence it cannot be opened.

The Solution

There are many things you could do at this point. The idea at the end of the day is to get that VM account the rights it needs to open the hard drive.

The most tempting solution is to simply go to the security tab and add the account. Set the permissions like those of other VMs (At the very least read and write permissions. I fear there is a lot of room for error on this approach so it is not my favorite. There is always the possibility you missed a setting and something might not work as intended. This brings me to my second and favorite solution:

Use Hyper-V manager to remove the disk from the Virtual Machine and then go back in to add it again. Apparently every time you add a virtual hard disk it will execute the required commands to give that Virtual Machine account the required permissions to the attachments. I say apparently because I can’t imagine how this didn’t happen in my case and I ended up getting the error message. Regardless, doing this did solve my issue and it is the Hyper-V manager fixing the permissions so I feel more confident it will get done correctly.

Finally there are many other ways to modify file permissions that you could use. Most importantly, there is always PowerShell. There is a “AddAccessRule” command you could apply to a VirtualMachine.HardDrive that will, of course, add the required access rules so that the VM can access said attached Virtual Hard Drive. Pretty neat right?

There is one said script that you could use found here: http://www.ntsystems.it/page/PS-Restore-VMPermissionps1.aspx. I haven’t tried it but it looks as it would work. I only had one VM to fix so it is much faster to do the Hyper-V manager operation than trying to download and then validate the script before executing it. But if you want to do this for a number of VMs you could use this to run it against

Enhanced by Zemanta

You may also like...

13 Responses

  1. Matt says:

    This worked great, thanks.

  2. Durien says:

    Thanks man! This just fixed an issue I had when I lost a drive array. Your second suggestion is what I tried first and it worked perfectly 🙂

  3. stevenmhouse says:

    Worked well. Thanks. Curious to how a working VM got into this state in the first place though.

    • Juan Carlos says:

      Well, I am clueless as well. My guess is somehow I managed to change the permissions on the file but obviously I don’t recall doing that. I hope someone else can shed some light on this one for us.

  4. David Smith says:

    This worked for me thank you so much!!!

  5. Renard says:

    It’s exactly what happened to my Hyper-V after an OS update. This solution works thx. Detaching and then attaching again a VHDX helped.

  6. 1lowellp says:

    Worked, thanks so much!!

  7. Adam says:

    Thank you it worked for mee to !!!

  8. jarydsemmens says:

    The digital equivalent of unplug, and plug it back in. Worked for me.

  9. SleepR says:

    Simple but works like a charm. Thanks

  10. sabbar says:

    the second one worked perfectly for me thank you

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.