I recently needed to run the Hyper-V Management Tools with alternate credentials.  In my case I was wanting to manage a domain joined Hyper-V server from a non-domain joined Windows Vista computer.  The easiest way to make this work is to have the same local administrator password on both systems, login as “Administrator”, and connect.

However, I wanted to be logging in as “Benjamin” not “Administrator”.  The way to get around this was fairly simple.  After using HVRemote to make sure that my server and client were correctly configured, I opened a command prompt and ran:

runas /user:Administrator mmc

This prompted me for my local administrator password (which I had set to be the same on the server and the client) and then started a blank MMC console.  I was able to add the Hyper-V Manager snap-in and connect to my server (yay!).  Now I needed to turn this into an icon I could just double click on.

The first step was to load the Hyper-V .MSC file using the following command:

runas /user:Administrator "mmc \"C:\Program Files\Hyper-V\virtmgmt.msc\""

Note that \” is an escaped quote (needed for quotes inside of quotes).  This prompted me for a password and ran the Hyper-V Manager.

The second step was to get rid of the prompt for a password.  This was done by adding the “/savecred” option for runas:

runas /savecred /user:Administrator "mmc \"C:\Program Files\Hyper-V\virtmgmt.msc\""

Now I just needed to create a shortcut that passed this whole command to CMD.EXE – as follows:

C:\Windows\System32\cmd.exe /s /c "runas /savecred /user:Administrator "mmc \"C:\Program Files\Hyper-V\virtmgmt.msc\"""

The final steps for creating my shortcut were to get a nice Hyper-V icon from “%ProgramFiles%\Hyper-V\SnapInAbout.dll” and to change the shortcut to run minimized by default (this way I do not see the command prompt flash by.

The net result is that I now have a nice shortcut that I just double click on and connect to my server using alternate credentials.