‘Unnamed VM’ could not initialize… The security ID structure is invalid (0x80070539)

While working on a system recently, I imported an old virtual machine – which then failed to start with this error message:

image

What to do?  Well – thankfully the solution is already documented here: https://support.microsoft.com/kb/2927313/en-us

But how did this happen?  And what is going on?

Well, Hyper-V allows you to grant access to the virtual machine screen for non-administrative users.  You can do this using the Grant-VMConnectAccess cmdlet.  However, if virtual machine screen access has been granted to a user account that no longer exists, Hyper-V does not handle it correctly.

Now, System Center Virtual Machine Manager uses Grant-VMConnectAccess automatically on all virtual machines.  So the easiest way to hit this problem is to take a virtual machine that is managed by SCVMM and move it to a Hyper-V server in a different domain.

Personally, I used a slightly different method than what is documented in the KB article above.  What I did was to open a PowerShell window and ran this command:

image

What am I doing here?

Using Grant-VMConnectAccess to add my current account causes Hyper-V to remove any invalid entries from the access table.  However, I do not actually need access (I am a Hyper-V Administrator – so I always have access).  Furthermore, if I just run Grant-VMConnectAccess, I will hit this problem again if I move the virtual machine to a host on a different domain.  So granting access and immediately revoking it solves the problem and makes sure it does not happen again.

Cheers,
Ben