Enabling Remote App on VMBus connected VM

Steps below will allow you to use RemoteApp connection (where your remote application will appear as stand alone application instead of entire desktop for remote desktop connection) over VMBus connection on local machine. This allows you to connect to instances of your VMs which are on segregated network or for that matter completely disconnected. Steps below were performed on Windows 10 client OS connecting to Windows 10 client OS running inside Hyper-V on the same machine.

Here is current Hyper-V state of my workstation

PS C:\> get-VM | select Property Name, State, VMID
Name State VMId
—- —– —-
2016ServerCore Off 18f3b782189f4be78d09254dc64c484d
Win10 Running ab1b03c96796480b9495421bdfa43d47
Win2016 Off 469a35853fc04f72b4d512cc7bbcbca9

view raw
a.ps1
hosted with ❤ by GitHub

Steps

  • Login into your VM and create registry settings as below which will allow powershell.exe to be launched as remote app remotely
PS C:\Windows\system32> get-item "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList\Applications\Windows PowerShell\"
Hive: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\TSAppAllowList\Applications
Name Property
—- ——–
Windows PowerShell Name : Windows PowerShell
Path : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
VPath : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
RequiredCommandLine :
CommandLineSetting : 1
IconPath : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
IconIndex : 0
ShowInTSWA : 0

view raw
a.ps1
hosted with ❤ by GitHub

 

  • Create RDP file like below. Replace GUID in first line with output of powershell command Get-VM above
pcb:s:ab1b03c9-6796-480b-9495-421bdfa43d47;EnhancedMode=1
full address:s:localhost
server port:i:2179
negotiate security layer:i:0
EnableCredSspSupport:i:1
allow font smoothing:i:1
allow desktop composition:i:1
audiocapturemode:i:1
audiomode:i:0
authentication level:i:2
autoreconnection enabled:i:1
bandwidthautodetect:i:1
compression:i:1
connection type:i:7
connect to console:i:1
devicestoredirect:s:*
drivestoredirect:s:DynamicDrives
disable wallpaper:i:0
disable full window drag:i:1
disable menu anims:i:1
disable themes:i:0
disable cursor setting:i:0
displayconnectionbar:i:1
enableworkspacereconnect:i:0
gatewayusagemethod:i:4
gatewaycredentialssource:i:4
gatewayprofileusagemethod:i:0
gatewaybrokeringtype:i:0
keyboardhook:i:1
networkautodetect:i:1
prompt for credentials:i:0
remoteapplicationmode:i:0
promptcredentialonce:i:0
redirectprinters:i:1
redirectcomports:i:1
redirectsmartcards:i:1
redirectclipboard:i:1
redirectposdevices:i:0
screen mode id:i:2
session bpp:i:32
span monitors:i:1
use multimon:i:1
selectedmonitors:s:0,1
videoplaybackmode:i:1
use redirection server name:i:0
bitmapcachepersistenable:i:1
usbdevicestoredirect:s:*
disableremoteappcapscheck:i:1
alternate shell:s:rdpinit.exe
remoteapplicationmode:i:1
remoteapplicationname:s:Windows Powershell
remoteapplicationprogram:s:||Windows Powershell

view raw
a.txt
hosted with ❤ by GitHub

  • Launch your RDP file as usual. First password prompt is for your desktop and second one will be for actual VM

mstsc_2018-11-08_11-08-03

Your will see powershell window launched as remote app (which will be indicated with overlay icon in your taskbar

2018-11-08_11-09-34

Once your have window running you can create child processes by just launching them from powershell prompt with start command like start cmd.exe or start notepad.exe which will launch those 2 instances on your desktop as a separate applications.

2018-11-08_11-11-51

You still have full access to normal RDP functions like shared clipboard, printers etc as well but has advantage of multi-monitor support and additional real estate support since you are only desktop space for applications you need and nothing else