Hyper-V Program Manager
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.
Great tip Ben, In Windows 7 shouldn't the Hyper-V Manager supporting running as a different use from the right click menu when you hold down shift? For that matter shouldn't the other Admin Tools also support this?
Is it possible for me to do e.g 'runas /user:DOMAIN\username mmc' from a machine not joined to the domain ?
I get an error 1326 Logon failure: unknown user name or bad password
Great post....exactly what I was looking for. Thx
Andy Robinson -
This is not possible. But you can create a local account with the same name and use that.
In Windows 8 you can press shift when right-clicking the shortcut, select "Run as different user" and then authenticate with a domain account which has access to the server.
I need to run Hyper-V manager as an account in one domain but connect to a Hyper-V server in another domain using credentials in that domain. Guess I am SOL.
You can use the /netonly switch, ie runas /netonly /user:SOMEDOMAIN\user , to use domain credentials from a machine not joined to the domain.
Great tip Chris - /netonly is very handy.
Probably worth a mention that you can't use /savecred and /netonly. It's one or the other...
Why does Microsoft not just pop up/show a credential prompt when trying to connect. Vmware does this correctly with vSphere client. The hyper-v management is all kinda clunky and poorly-executed from what I have seen.
Easiest solution is Microsoft make a normal hyper v manager, and not users spending hours trying to connect from one computer to another this is ridiculous.
I really really wish this was just a little more straight forward. Does it really have to be this way?