Full Sound Through RDP From a Hyper-V Windows 7 VM

Windows 7 is a nice operating system and it has some pretty cool features. One of which, and one of my favorites, is that it comes with the newest version of Remote Desktop (RDP). This version is capable of letting you watch HD video through it (assuming your network connection is fast enough…). RDPing from one physical computer to another physical computer is easy and sound between the two works just fine. This is because both machines (most likely) have physical sound cards.

Sometime during my travels, I loaded Windows 7 onto a Virtual Machine (VM) running on Hyper-V Server 2008 R2. Virtual Machines in Hyper-V don’t have physical or even virtual sound cards like VPC. When RDPing to a Windows 7 VM the sound card is listed as Remote Audio. This is fine and will actually push through a decent amount of sound. While testing, it seemed to work fine for WMV files and a few other formats. For some reason, I was unable to get it to work with AVI files, and flash websites like youtube.com. I wanted full sound capabilities. So here is what I was able to get working.

All the changes you make will need to be within the Windows 7 VM.

First off, I recommend backing up some registry keys. I would rather not have anything broken on your end.

Click on the start button and type regedit and hit enter.
Browse to:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32

Right click on Drivers32 and click Export. Save that somewhere safe in case you need to revert back.

Now that thats taken care of, open notepad and paste this in:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32]

Save the file as “sound.reg”. I like to keep all of my scripts in one location; c:\scripts so I saved my file as c:\scripts\sound.reg. But you can save yours wherever you like.

Next create another text file and paste this in it:

Remove-Item -Force 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32'
regedit /s c:\scripts\sound.reg

This script will delete the old registry and load in our new audio registry. If you saved the sound.reg file somewhere else, you will need to change that last line. This script is partially Powershell, so we will need to save it as a ps1 file. I saved mine as c:\scripts\sound.ps1

Now, our scripts are built. We have a few extra things left to do in order to get them to work.

If you have never ran a PowerShell script before changes are you will need to make a quick change:

Open Powershell and type:

Set-ExecutionPolicy Unrestricted

Why do I need to do this?

At the prompt type Y enter.

At this point, whenever you run that powershell script the sound should work fully. AVIs WMVs MP3s Flash/youtube you name it. But I ran into one last problem. Whenever I reboot the VM, my settings disappeared and the sound didn’t work again. So, the quick fix for that was to right click sound.ps1 and click create shortcut. Then move that shortcut file to start->all programs ->startup folder.

And thats it. Every time I RDP into the VM the script runs and re-fixes the sound so that I can listen to anything I want.

Note: While older MS OSes like Windows Vista/XP/2003 don’t do well with video over RDP :/, in theory this should work to allow full sound on them.