Restore file permissions on VHD file after move

Posted: 26th September 2011 by Seth Killey in Virtualization

A bit of a scary moment for me the other day.  I changed the virtual hard disk path on one of my virtual machines from the disk GUID to the appropriate CSV path in preparation for Hyper-V live migration.  After changing the path, the Virtual Machine SID permissions were stripped and therefore Hyper-V couldn’t take control of the file as necessary.  In order to restore the file permissions I ran the following:

icacls “<path to VHD>.vhd” /grant “NT VIRTUAL MACHINE\<virtual machine SID>”:F

If you don’t know the virtual machine SID, navigate to the folder storing your virtual machine files and click on the Virtual Machines subfolder.  Inside this folder is an XML document named the same as the SID