How to fix Microsoft Hyper-V Error: The application encountered an error while attempting to change the state of ‘New Virtual Machine’.

The Error:

The application encountered an error while attempting to change the state of ‘New Virtual Machine’.

‘New Virtual Machine’ failed to start.

Synthetic SCSI Controller (Instance ID xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx): Failed to Power on with Error ‘General access denied error’.

Hyper-V Virtual Machine Management service Account does not have permission to open attachment ‘D:\vm.vhdx’. Error ‘General access denied error’.

Hyper-V Error: Virtual Machine Connection - 'New Virtual Machine' failed to start
Hyper-V Error: Virtual Machine Connection – ‘New Virtual Machine’ failed to start

Note: Other similar errors which is related to virtual hard drive (vhd, vhdx) permission issue when starting the Hyper-V virtual might also be fix by using following method.

The Fix:

Method 1:

Remove the virtual hard drive from virtual machine via Hyper-V Manager then reattach the hard drive

Method 2:

1 We need to get the SID of the virtual machine, usually it will be displayed in the error dialogue. If you have the SID continue with step 2, If not, follow the steps below:

1.1 Open the Run window by using Win + R key combination.

Microsoft Windows - Run window
Microsoft Windows – Run window

1.2 Type virtmgmt.msc and hit “OK” button

1.3 Write down the name of the virtual machine which is having perimssion issue.

1.4 Use key combination Win + X, click on Windows PowerShell (Admin) to open PowerShell window. Type following command and hit Enter key (Replace Name of Virtual Machine to your virtual machine’s name)

Get-VM 'Name of Virtual Machine' | Select-Object VMID
Windows PowerShell -  Get-VM 'Name of Virtual Machine' | Select-Object VMID
Windows PowerShell – Get-VM ‘Name of Virtual Machine’ | Select-Object VMID

2 Enter following command in PowerShell to grant permission for this virtual machine to attach the virtual herd drive. ()

icacls "<Path of .vhd or .avhd file>" /grant "NT VIRTUAL MACHINE\<Virtual Machine ID from step 1>":F

or

icacls "<Path of .vhd or .avhd file>" /grant "<Virtual Machine ID from step 1>":F

Tip: By default Hyper-V store virtual machine configuration files in “C:\ProgramData\Microsoft\Windows\Hyper-V”, hard drives in “C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks”