Can't Start Virtual Machine After Overwriting Virtual Hard Disk

Rate This
  • Comments 3

I have been working on a personal project recently.  My goal is to completely automate the process of building a virtual machine - without using templates.

As I have been working on this process, I have been making and deleting the same virtual hard disk over and over. 

This causes an interesting problem.  If you have a virtual machine all configured and ready to go - but you then replace the virtual hard disk file (i.e. delete the current .VHD file and create a new one in the same place with the same name) - when you try to start the virtual machine it will fail.

Instead of starting you will get an error message like this:


The problem here is the permissions on the new virtual hard disk.  When you attach a virtual hard disk to a virtual machine Hyper-V will change the permissions (access rights) on the virtual hard disk.  This needs to be done because Hyper-V virtual machines run under their own account, and this account needs to have permission to access the virtual hard disk.  When you switch the virtual hard disk file of a virtual machine you lose these permissions.

Fixing this problem is simple - but not obvious.  What you need to do is:

  • Open the virtual machine settings (through the Hyper-V manager)
  • Find the virtual hard disk in question
  • Remove the virtual hard disk (use the remove button)
  • Apply the changes
  • Add a new virtual hard disk and configure it to point at the same virtual hard disk as before
  • Apply the changes

This should only take a couple of seconds to do, and it fixes the virtual hard disk permissions so the virtual machine will start again.


Leave a Comment
  • Please add 5 and 2 and type the answer here:
  • Post
  • So, it's same even if you use Hyper-V v3..

    Why don't you simply check ACL of the VHD before starting process? It adds a few seconds only and should be acceptable if you are not in hurry.

  • icacls.exe can help to automate this, i.e.

    icacls E:\NewClient.vhd /grant "NT VIRTUAL MACHINE\VM_GUID:(R,W)"

    VM_GUID can be obtained from Hyper-V host WMI.

    In cluster configuration, icacls.exe must be executed on the host where VM has been created.

  • Dmitri -

    That is correct, and thanks for the extra information.



Page 1 of 1 (3 items)

Can't Start Virtual Machine After Overwriting Virtual Hard Disk