Auto Add

Thursday, 24 May 2012

How To Configure Remote Desktop To Hyper-V Guest Virtual Machines

Configuring Remote Desktop (RDP) from a host Hyper-V machine to a guest virtual machine can be tricky, so this post is dedicated to the issues and resolution steps I went through to allow RDP.  Cutting to the point, below are the things to look for followed by some explanation about my scenario if you care to read.  This is not an exhaustive list of what is required, just the items that were causing problems for my particular scenario.

Requirements

  1. Allow Remote Desktop Connections in guest OS.
  2. The network adapter type must allow communication with host machine (e.g. use an “Internal” or “External” virtual adapter.)
  3. If running Server 2008 R2 on guest, network discovery mode must be turned on.
  4. If running Server 2008 R2 on guest, the services supporting network discovery mode must be running: - DNS Client
    - Function Discovery Resource Publication
    - SSDP Discovery
    - UPnP Device Host

My Environment

    A quick word about my environment.  I am running Windows Server 2008 R2 with Hyper V on my laptop and numerous guest VMs running Windows Server 2003 R2 or Windows Server 2008 R2.  I run a domain controller VM and then 1 or 2 SharePoint servers depending on my work needs.  I’ve found this setup to work well except when it comes to the display window for my VMs.

Allow RDP Connection

    This item I had previously taken care of, but it bears repeating because by default Windows Server 2008 R2 does not allow RDP connections.  Change the setting from “Don’t allow…” to whichever “Allow connections…” setting suits your needs.  I chose the less secure option as this is just my dev laptop.
ConfigureRDPHyperVGuest8

Network Adapter Type

    When I originally configured my VMs I configured each to use 2 network adapters: one using the physical ethernet adapter for internet use and a virtual private adapter for communication between the VMs.  The connection for the ethernet adapter is an "”External” adapter and (as my co-worker Kelly Jones pointed out in comments below) does allow connections between host and guest.  After he pointed this out though I realized that my ethernet adapter is not always reliably enabled (power cord not in disables NIC.)  As such I need a secondary adapter that will always be on to connect the host and guest.  The virtual private adapter I had allowed communication ONLY between the VMs and not to my host.  There is a third option “Internal” which allows communication between VMs as well as to the host.  After finding out this distinction I promptly created an Internal network adapter and assigned that to my VMs.
ConfigureRDPHyperVGuest1

Turn On Network Discovery

    Seems like a pretty common sense thing, but in order to allow remote desktop connections the target computer must able to be found by the source computer . One of the settings that controls if a computer can be found on the network is aptly named Network Discovery.  By default Windows Server 2008 R2 turns Network Discovery off for security purposes.  To enable it open up the Network and Sharing Center.  Click “Change Advanced Sharing Settings” on the left.  On the following screen select “Turn on network discovery” for the currently used profile and click Save Settings.  You may notice though that your selection to turn on network discovery doesn’t save.  If this is the case then you most likely don’t have the supporting services running (as was my case.) ConfigureRDPHyperVGuest4
ConfigureRDPHyperVGuest5

Network Discovery Supporting Services

    There are a total of 4 services (listed again below) that need to be running before you can turn on network discovery . The below images highlight these services.  In my guest VM I found that I had DNS Client already running while the other 3 were disabled.  I set them all to enabled and started the ones that were stopped.  After this change I returned to the Sharing settings screen and found that Network Discovery was turned on.  I’m not sure whether this was picking up my attempt to turn it on previously or if starting those services turned it on.  Either way the end result was a success.
- DNS Client
- Function Discovery Resource Publication
- SSDP Discovery
- UPnP Device Host
ConfigureRDPHyperVGuest2 ConfigureRDPHyperVGuest3

Before and After Results

    The first image is the smaller square shaped viewing window used by the Hyper-V native connection.  The second is the full-screen RDP connection in all its widescreen glory.
ConfigureRDPHyperVGuest6 ConfigureRDPHyperVGuest7


No comments:

Post a Comment

Microsoft Intune, a Compliance Policy

  In Microsoft Intune, a Compliance Policy is a set of rules and settings that a device must meet to be considered "healthy" and ...