I came across the situation where a Juniper tool provides Secure Access SSL VPN with a hard token and then starts the associated application for a generated .rdp file. I would just like to also use Royal TS for managing this machine, and am hesitant to going back to plain mstsc.exe, the application which is normally associated with .rdp files.
Important detail: the Juniper tool "starts" the .rdp file, and when the associated application is closed, the .rdp file is removed and the ssl vpn connection is closed, so I can only connect a remote desktop client for as long as the application (associated with .rdp files) runs.
The solution for my personal case actually turned out to be quite simple: I have associated my .rdp files to a .bat file which checks the path of the .rdp file, and if it is a generated .rdp file it starts a pre-configured Royal TS connection (luckily Juniper allows to set a fixed port), otherwise it starts the standard mstsc.
This works fine for my one Royal TS connection but should you need more, then a more viable solution could be to e.g. adapt the csv-to-rts powershell script elsewhere in this forum…
Otherwise, here is my solution, summarized in 3 steps:
1. In the Terminal Sessions panel on the secure gateway home page, click to edit the properties of the terminal services session bookmark: in section "settings" enter a fixed client port, and leave section "session" empty (other settings might not trigger .rdp file generation).
2. In Royal TS, create a connection to 127.0.0.3 with the same fixed rdp port as in the previous step; the name of this connection is used in the next step, as well as the path of the .rts document you save this connection in.
3. Associate .rdp files to a script similar to this .bat file:
@echo off
set exit=0
set this="%~0"
if "0%exit%0"=="0!exit!0" goto :main
start %this% /b /i /low /min /wait cmd /v:on /s /c "%0 %*"
@exit /b %ERRORLEVEL%
:main
set arg="%~1"
set argjuniper=!arg:\Juniper=!
set argjuniper=!argjuniper:\JUNIPE~=!
if not !arg!==!argjuniper! goto :juniper
start "standard .rdp" "%SystemRoot%\system32\mstsc.exe" %*
goto :done
:juniper
set rtsdocumentpath={enter path to .rts document here}
set connectionname={enter connection name here}
title !connectionname!
"%ProgramFiles%\code4ward\Royal TS\RTSApp.exe" !rtsdocumentpath! /connect:!connectionname!
:done
title done
@exit !exit!
The script does not actually use anything from the .rdp file except its path, but now when one clicks to start a session on the secure gateway home page, Royal TS is started and automatically connects to the configured host over the ssl vpn connection. The script does not wait for mstsc to finish, but it does wait for rtsapp to finish, otherwise the connection would be prematurely closed.
Hope this helps!
PS: While I am helping :] here is an interesting post for regular vpn connections.