Acces denied for windows image for hyper-v

When you can’t start machine because of the permissions(access denied for….) first you need to find out the id of the virtual machine created in hyper-v. You can do that using:

Get-VM ‘Your_VM_name’ | Select-Object VMID

You will get somethinf like

VMId
—-
9bof4bbb-9565-42a4-8b13-c4f63e5813a7

After this you need to grant access to your file(windows image or virtual hard drive using icacls command(don’t forget :F at the end):

icacls “path\to\Windows.iso” /grant 9bof4bbb-9565-42a4-8b13-c4f63e5813a7:F