I need to specify command line arguments for a RemoteApp using the remoteapplicationcmdline property of a signed RDP file.
However, after the RDP file is signed, I cannot change the value for remoteapplicationcmdline. If I remove remoteapplicationcmdline from the signscope, I can’t specify any parameters.
This is the same question asked by Chupkb on Technet.
I might be able to do as Naraen suggested on this question, but before I do that I’m hoping there is a simpler way.
The route I eventually took was to gather the command line arguments from a previous page (perhaps a login page) and then on the next page I dynamically create an rdp file, sign it, and embed the contents into the javascript on the html page. The code below is ASP.NET and c# but it should be a good starting point for other languages as well.
First, the html (notice the <%= RdpFileContents %> in LaunchRemoteApp():
Then I created a template RDP file with all the correct content. Notice the remoteapplicationcmdline value has some dummy command line parameters (FirstName, LastName, CustomerID). You’ll replace these as appropriate in your code.
Then in the code behind, I load the template rdp file, replace the command line arguments, write to a temp rdp file, sign the temp rdp file, and embed the resulting contents into the javascript at <%= RdpFileContents %>
The final javascript will look something like this:
I tried to escape the rdp contents myself but could never get it to work. If you don’t have access to Microsoft.JScript.GlobalObject.escape() function, you can try it yourself. Here are some of the character entity references I know of:
Replace : with %3A
Replace | with %7C
Replace \r\n with %0D%0A
Replace spaces with %20
No extra spaces after lines.