So those of us on the Windows Developer Preview (a.k.a.) Windows 8 and who love our virtual machines have probably already tried the built-in Hyper-V of Windows client. This is really nice toolset, but the Hyper-V console is so feature limited compared to VMware Workstation 8 that sometimes basic things like copy/paste, sending files between host and VM is *seriously* painful.
Thankfully there are ways to get around these limitations and replicate much of the VMware experience…
So for my setup this is what I’ve done
#1 – Allow Non-Administrator To Run Virtual Machines
I always log into my computer as non local Administrator account, so I would have to “Run As” or elevate the Hyper-V console. Thankfully it is easy (but totally not obvious) to add local users full access to Hyper-V
To do this we’ll just load azman.msc. To launch it I just hit Start key, typed it in, then hit Ctrl+Alt+Enter to force it to run as Administrator
The first thing we need to do is right click top of the tree and select Open Authorization Store
We then browse to %ProgramData%\Microsoft\Windows\Hyper-V\InitialStore.xml and open this store.
Then under InitialStore.xml –> Hyper-V Services –> Role Assignments –> Administrators you can right click and select Assign Users & Groups –> From Windows and Active Directory…
You can now either add your own logon account, or all local users if you desire. (Users group)
#2 – Clipboard & File Copy Access
OK this is probably the most painful one. While useful from a security standpoint it can be quite annoying not being able to easily transfer files to and from your VM.
Andrew Connell posted a how-to setup local network about 2 years ago here http://www.andrewconnell.com/blog/articles/allowing-a-host-machine-to-talk-to-guest-vms-in.aspx and we’ll base our solution on a similar process.
First we need to open our Hyper-V Manager and the Virtual Switch Manager
We then create a new Internal virtual switch
Leave the default options, but I changed the name to Internal and you can add some notes if you so desire.
Now this has added a “Virtual” network adapter to our computer. But with Internal network adapters alone we won’t have any communication. So we’ll need to set a static IP on this adapter. Because I connect to many different networks in the 10.x.x.x, 192.168.x.x and 172.16.x.x-172.31.x.x IP ranges how to select what IP range?
I decided to use the Automatic Private Internet Protocol Addressing (APIPA) range, which is 169.254.0.1 through 169.254.255.254 as I can feel safe this is not going to interfere with any network I’ll connect to.
To change the IP of your network adapter right-click the wired or wireless network icon in the system notification area and select Open Network and Sharing Center
I then select Change Adapter Settings
You will find your adapter with the words “INTERNAL” below it. But I will rename the adapter to HYPER-V Internal
OK now it’s nice and clear…
I then right click and select Properties. In the HYPER-V Internal Properties I select Internet Protocol Version 4 (TCP/IPv4) then Properties
I then set the IP to 169.254.0.1 with a subnet mask of 255.255.255.0
Now I selected one of my virtual machines, right clicked it and opened Settings. I selected Add Hardware and added a network adapter and set it to Internal network…
I then went into my virtual machine. Because this was the second network adapter I had added I looked for Local Area Connection 2 and renamed it to Hyper-V INTERNAL
This time I set the IP to 169.254.0.2 with subnet 255.255.255.0. I also set a local gateway of 169.254.0.1. Why the local gateway? Without it Windows 7 would have picked up the network as “unidentified” and “Public” and not given me the option to change it. Adding a gateway will let me select Home or Work and automatically opening certain firewall rules.
When prompted I set mine to work, and you can see here what it looks like.
Now we just need to make sure we’ve enabled remote desktop on our VM. Simply type remote desktop into the start menu if your VM is Windows 7 and you can select the option immediately
Ensure Allow Connections are allowed, add any non-admin users here as well that might need the remote desktop access.
The final step is to create a remote desktop icon that lets us do everything we’ve been waiting to do!
So we open up mstsc.exe and start with our IP address configuration, and if we want quick & easy access add our username and password. (Just keep in mind if you save your password here and somebody has access to the RDP file they can get your password – it is reversible encryption)
Under Local Resources though is where the magic is. By default audio playback will work over remote desktop. If you need to add mic input into the VM then in Remote audio settings you can enable this.
Under Local Devices and Resources click More…
You can then map USB drives, local drives, CD-ROMS, network drives all into your local VM
Once you set it up the way you like it you can save the RDP file to a location like the desktop for quick & easy access. The first time you connect you may get a warning. Because we know we just created this we needn’t worry and select Don’t ask me again if you want then connect.
We can now copy & paste clipboard (including files) to and from the VM, print from the VM, and copy files to our local drives if we need to.
Your host’s drives will all be available as network locations \\tsclient\<drive letter on host>
i.e. If you allowed C: drive access \\tsclient\C