Suddenly I got an error when creating a new VM, which I do fairly often:
New-VM -Name LAB2 -Path X:\VMs\Lab2results in:
User 'pc\******' failed to create external configuration store at 'X:\VMs\Lab2\LAB2': General access denied error. (0x80070005) You do not have permission to perform the operation. Contact your administrator if you believe you should have permission to perform this operation.
I was running the command as an elevated administrator, so why would I get this error. It turned out the permissions on the directory 'Virtual Machines Cache' got changed.
To fix this, I ran the following in an elevated PowerShell:
& icacls.exe "$env:ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines Cache" /t /Q /grant "NT VIRTUAL MACHINE\Virtual Machines:`(0I`)`(CI`)`(R,WD,AD`)"
sfc /scannowwhich I ran a few days ago.