Thursday, April 18, 2013

What is RemoteFX on Windows 2012 Hyper-V and Deploying a Win 8 Virtual Desktop


Updated 2/3/2017 for Windows Server 2016 and Windows 10!

RemoteFX is Microsoft's advanced desktop RDP solution based on technology acquired from Calista Technologies. It allows for the following functionality above and beyond standard RDP:

This Article Written in RemoteFX. It's... amazing?

Server 2008r2 Based:

  • Virtualized 3d GPU: you can split a single GPU into multiple virtual GPUs for VDI VMs. This allows for 3d accelerated apps to run in the RDP session.
  • RemoteFX Codec: A more advanced version of the RDP compression scheme that allows for more efficient streaming of both video and audio. While it works fine for text, you can always get groceries in a Yugo
  • USB Device redirection: Now you can finally use your USB Scan Toaster on your remote desktop!

Server 2012 Additions: 

  • Multi-Touch: Multi-Touch support through RDP. Needs a compatible client! (RDP 8.0, etc.)
  • Adaptive Graphics: Different compression codecs depending on the content (dynamically on a given screen) among other enhancements. 
  • Media Redirection API: Used primarily to facilitate rendering audio and video of VOIP clients local to the client. (Only Lync right now) 
  • WAN Enhancements: Support UDP; tweaks to lower bandwidth requirements for both remote and WiFi scenarios.  
  • GPU Changes: Support either a software-emulated GPU or a real hardware GPU. DX11 support added. 

Server 2016 Additions: 

  • OpenGL/CL Support: Now supports hardware-accelerated OpenGL (^4.4) and CL (^1.1)... CAD/Lightwave/Photoshop users rejoice!
  • vRAM Assignment Enhancements: Decouple vRAM amount from monitors and resolution, increased dedicated vRAM per host capability to 1GB from 256MB. 
  • Better Performance: More FPS=smoother performance. Noticeable in my case, videos now watchable through RemoteFX without the audio issues that sometimes accompanied the prior version. 
  • Generation 2 VM Support: Allows for use of the new VM platform and all the associated features
  • ... and more, see the reference links at the bottom of this article.

Hardware Requirements:

Full MSFT Article , RDS Blog reqs link
  • The standard HyperV Requirements
  • SLAT Enabled CPU; EPT on Intel, NPT/RVI on AMD
  • DX11 (WDDM 1.2) Compatible GPU; All made for purpose DX11 GPUs from NVIDIA and AMD work, and for testing I've been using a consumer grade NVIDIA 650 in my lab without issue.

Software Requirements:

  • Server: Server 2012/2016 (core preferred, see next section)
  • Client: Windows 8/10 Enterprise, and Enterprise only. Pro won't work. Additionally, I found that re-keying a Win8 Pro to Enterprise install will not work either. While it will report that all is well, and it will install the RemoteFX graphics adapter, when you try to connect it will report "error during licensing protocol" in the final stage of connection negotiation.

Setup

Assumptions

  • You have a fully functional HyperV Host that meets the hardware requirements listed above.
  • You're using server core. You can do this on standard, but you should be using core for performance and patching (or lack thereof) reasons. The commands I relay assume core. 

Prepare the Host

  1. Patch it up; make sure you're fully up to date. 
  2. Install the graphics drivers for your GPU on the host. This may pose some issues on server core, but fortunately I've got a guide for NVIDIA GPUs to help. The procedure is most likely similar for AMD GPUs. Bounce the host after driver install regardless of if it tells you to do so or not. 
  3. Install the Remote Desktop Virtualization Host feature. Either use the server manager remotely to do so, or execute the following directly on the Hyper-V host: "Install-WindowsFeature –name RDS-Virtualization -source j:\sources\sxs" where J: is the DVD-ROM or image with the 2012 install bits. You can use other sources if desired, for more information see this post.
  4. Reboot the server. 
  5. Enable the Adapter for use with the Hyper-V host by opening the Hyper-V management console, right click the server->Hyper-V Settings....
  6. Select "Physical GPUs"
  7. If configured correctly, you should see your adapter listed. Check the "Use this GPU with RemoteFX" box and click "OK". 


Alternatively for steps 5 through 7 you can use the following powershell cmdlets: 

Setup The VM


  1. As noted above, only Win 8 (7 if you want, update + 10) Enterprise will work. Use a template or build from scratch. There are no special needs at build time. 
  2. Enable RDP on the Win8 VM
  3. Install the VM Integration services & shut down the VM
  4. Add a 3D Adapter to the VM by opening the Hyper-V management console, right click the VM->Settings
  5. Under "Add Hardware" select "RemoteFX 3D Video Adapter", click "Add", select the max resolution and # of monitors you plan on using via RDP, and select "OK"
  6. Start up the VM. You now will need to logon via RDP, as the Hyper-V remoting will be locked out. The machine should notify of new hardware being installed that requires a reboot. If it does not, re-install the integration services. Reboot the VM. 
  7. To ensure the VM is operating with the adapter open device manager and look under "Display Adapters". You should see "Microsoft RemoteFX Graphics Device - WDDM"

Alternative Powershell Command:


Configuration

Note that unlike the previous version of RDP, you don't need to select your connection speed on RDS 8.0. So that said, the only configuration you really need in 8.0 can be done via GPO.

Adjust Settings via GPO


Primer: Modifying GPO settings.

Microsoft makes some RemoteFX settings "Tweakable" via GPO. These settings can be found here:

Computer Configuration->Policies->Administrative Templates->Windows Components->Remote Desktop Services->
  Remote Desktop Connection Client->RemoteFX USB Device Redirection
     -Allow RDP redirection of other supported RemoteFX USB devices from this computer
  Remote Desktop Session Host->Remote Session Environment
     -Configure compression for RemoteFX data
     -Configure image quality for RemoteFX Adaptive Graphics
     -Enable RemoteFX encoding for RemoteFX clients designed for WindowServer 2008r2 SP1
     -Configure RemoteFX Adaptive Graphics (Tweak if using only on a LAN)
     RemoteFX for Windows Server 2008 R2
        -Configure RemoteFX (this just allows for disabling RemoteFX via GPO)
        -Optimize visual experience when using RemoteFX (Tweak this one if using only on a LAN)
        -Optimize visual experience for Remote Desktop Service Sessions (Change to "Text" if you setup RemoteFX so Bobby can do his spreadsheets. Why did you setup RemoteFX again?)

Troubleshooting

 

Sound isn't working on the youtubes! : Seems like flash doesn't work correctly with audio redirection. HTML5 works though! Switch to the HTML 5 beta by going here.

Seems Slow: Make sure your color depth is set to 32bit. Based on my testing it seems that the codec favors full 32 bit color.

FAQ (By me of myself @ least, and by frequently I mean once until I answered them)

  • Q: Should I want to, what can I use to benchmark this thing?  A: PassMark works great; I must admit that watching DX11 accelerated 3d benchmarks through an RDP session is kind of cool. :) 
  • Q: Does RemoteFX work through an RDP gateway? What versions? A: Yup, it works through a gateway running on 2008, 2008R2, or 2012.
  • Q: Is GPU performance good enough to run intensive applications or GPU computation tasks? A: In most cases, no. The RemoteFX solution virtualizes the GPU and exposes it as a Microsoft "GPU", essentially translating all requests through a proxy driver. While that solution allows for splitting the GPU across multiple VMs, it also makes for reduced functionality/performance of the card since the OS isn't exposed directly to the native driver. Additionally, framerate is limited by the RDP protocol itself.
  • Q: Does RemoteFX support accelerated OpenGL? A: No, it is done in software.
  • Q: Can RemoteFX do GPU direct passthrough? A: No, only Xenserver Enterprise or higher can do that right now. 
  • Q: How do I know how much memory on my GPU is being used by my VMs? A: You can find the answer on the Hyper-V/Physical GPUs page for each server. The memory stats are listed right under GPU Details->Summary. 
  • Q: Can I deploy RemoteFX in a VDI environment? A: Yeah, though note your max simultaneous RemoteFX sessions will be limited by available GPU memory. (See above post) Fortunately for you, I have a guide on how to setup Hyper-V based VDI!
  • Q: Will this VMWare tweak help up the framerate on Hyper-V/RemoteFX? A: In my testing, it did not. I suspect this is because the HyperV NICs probably don't support interrupt coalescing. It looks like one could enable interrupt coalescing on the host with the following instructions and perhaps that would change the answer depending on how the packets are handled from the RemoteFX machine. 

References

Microsoft: What is RemoteFX?
RDS Blog: RemoteFX Features for Windows 8 and 2012
Technet: Frequently Asked Questions and Troubleshooting Tips
RDS Blog: Your desktop will be a rich DX11-based experience, and your virtual GPU should be too
My Crazy Adventures with RemoteFX, Part 1

2016 Updates

Enterprise Mobility and Security Blog: RemoteFX vGPU Updates in Windows Server Next
Technet: Experience guide for Enabling OpenGL Support for vGPU in Server 2016

Questions/Concerns? Contact me or leave a comment!

Sunday, April 14, 2013

Azure Ate My VM! Or: How to Get Your VM Back

If for any reason your Azure account is suspended (exceeding 90 day compute per month, exceeding monthly spending limit) your IaaS VMs will be deleted. It would appear as if this is normal. Fortunately your disks associated with your VM are not deleted, so we can recover. Hopefully, this is something Microsoft addresses in the near future. For now, let's fix it!

Oh No! Peaches02 is missing!














 

Fix It

  1. First we'll need to reclaim our DNS address. To do so, click on "Cloud Services" and delete the cloud service that is squatting on the name of your old VM you want to recreate.
  2. Now we will recreate the VM using our pre-existing disk. Fortunately, this disk will present itself in the "gallery". Click "New" on the lower left. 
  3. Select "Compute"->"Virtual Machine"->"From Gallery". You'll see your disk in there. Select it.
  4. Set the name to the same as it was before. The size though, can be changed if you like. (For example, I took mine from medium to small)
  5. Set the DNS name to the same as it was before, and select the region as you desire. 
  6. Associate with an availability set if you like and fire it up!


Notes: 


Your RDP port will probably change because of the way MSFT does Natting for the virtual IPs. I was honored to have 3389 on my vm for the first go-around, but when I set it up again MSFT had already given that port back out. It will automatically create a new NAT (endpoint) mapping, so to determine the new port navigate to virtual machines->(VM)->endpoints and take note of the new RemoteDesktop port.

All your endpoints will be deleted. This can be a real pain if you have alot, but fortunately I have a solution for that.

If there are any questions, let me know. Happy clouding!

Monday, April 1, 2013

CentOS ready for Hyper-V 2012 NICs

CentOS 6.4 was released on March 13th, and per the release notes it now ships with the Hyper-V components. Now the native network adapters work right from the base install, even on the minimal distribution. All that need be done is enable the adapters after install. To do so, do the following:


  • Log in as root
  • Navigate to /etc/sysconfig/network-scripts
  • Each NIC config is located in this directory. The configs are named ifcfg-ethX where X is a number starting with 0 and incrementing by 1 for each adapter, i.e. ifcfg-eth0, ifcfg-eth1. Edit each by typing "vi ifcfg-eth0"
  • At the least, you will need to edit the file to change ONBOOT=no to ONBOOT=yes by using the following keys:
    • INSERT
    • (make your modifications)
    • ESC
    • :w
    • :q
  • Reboot
If you want to make further modifications such as static IP, etc, then refer to this guide. Feel free to post questions!

Update 12/8/2013: 

When updating/rebuilding my Hyper-V hosts from 2012 to 2012 r2 the MAC addresses seem to have changed. (Perhaps a good reason to set static MAC addresses on these VMs) You can see if your install exhibits this behavior by examining the following:
  •  cat /var/log/dmesg | grep -I "net"
and looking for:

hv_netvsc vmbus_0_13: Device MAC XX:XX:XX
and
udev: renamed network interface ethX to ethX

To fix it, edit the ifcfg-ethX file as noted above and change the HWADDR entry to match the new MAC, and then remove the /etc/udev/rules.d/70-persistent-net.rules file and reboot.