An Error Occurred While Attempting To Start The Selected Virtual Machine ‘General Access Denied Error’ #HyperV

Hello folks,

The other day, I upgraded my Hyper-V host with the fastest Solid State Drive in the market right now.

It’s quite expensive, but it deserve the performance Open-mouthed smile

Sequential Read: 550 MB/s.
Sequential Write: 550 MB/s.
Random Read: 100,000 IOPS.
Random Write: 90,000 IOPS.

Now before I replaced the disk, I copied all my Virtual Machines to a safe location, I replaced the disk and then restore all the Virtual Machines back.

When I attempt to start one of the Virtual Machine…

Sorry Sad smile

Start-VM-GeneralAccessDenied-01

The error message indicates clearly that Hyper-V does not have enough permissions to access the virtual hard drive. The problem is because I copied all my VMs from one drive to an external drive. Therefore the virtual Machine SID of the virtual hard disk is missing.

Start-VM-GeneralAccessDenied-02

A while ago I came across a similar issue here An Attempt to initialize VM saved state failed – Could Not Create or Access Saved State File.

The most common solution is to simply go to the security tab for each Virtual Hard Disk and add the account. Set the permissions (Read/Write). However there is a lot of room for error on this approach, so it is not my favorite. There is always the possibility you missed a setting and something might not work as intended.

The second option is to use icacls as documented in the following KB article.

The third and my favorite option is to Use Hyper-V manager to remove the disk from the Virtual Machine and then go back in and add it again.

Start-VM-GeneralAccessDenied-03

Because every time you add a virtual hard disk, Hyper-V will give that Virtual Machine account the required permissions to the virtual hard disks.

Start-VM-GeneralAccessDenied-04

Now this works great if you have couples of Virtual Machines, but what about if you have dozens of VMs, and each VM with several virtual hard disks. Sad smile

Start-VM-GeneralAccessDenied-05

PowerShell to the rescue again Winking smile

For that reason, I wrote a script that would allow you to specify a single virtual machine or a Hyper-V host, and the script would:

1. Turn Off the VM if it’s running (most of time the VM is in offline state because of the missing permission, but there are certain scenarios where the VM is in Saved State, you need to force shut down).
2. Remove any VHD/X files attached to any of the VM’s controllers with missing Virtual Machine Id permission.
3. Check if the VM is using Shared VHD/X.
4. Attach the VHD/X files back to the same controllers and locations in the VM settings.
5. Start the virtual machine.

Start-VM-GeneralAccessDenied-06

Hope this helps!

Enjoy your weekend…

Cheers,
@Charbel

About Charbel Nemnom 311 Articles
Charbel Nemnom is a Microsoft Cloud Consultant and Technical Evangelist, totally fan of the latest's IT platform solutions, accomplished hands-on technical professional with over 15 years of broad IT Infrastructure experience serving on and guiding technical teams to optimize performance of mission-critical enterprise systems. Excellent communicator adept at identifying business needs and bridging the gap between functional groups and technology to foster targeted and innovative IT project development. Well respected by peers through demonstrating passion for technology and performance improvement. Extensive practical knowledge of complex systems builds, network design and virtualization.

Be the first to comment

Leave a Reply