none
%CLIENTNAME% not available when launching published application via RemoteApp RRS feed

  • Question

  • We are trying to get a published application to work on Window Server 2012 R2 that requires the %CLIENTNAME% environment variable. When logged in locally on that Remote Desktop Server the variable is available and works as expected. When we publish our application and try to reference %CLIENTNAME% we then receive an error that nothing is set for %CLIENTNAME%. I have checked the HKCU\Volatile Enviroment\ and I can see the session with the CLIENTNAME there.

    If we change the application to use %USERNAME% or %COMPUTERNAME% than it will input the corresponding values, so I know it is reading some environment variables. 

    Our clients are Windows 10.

    Monday, December 12, 2016 7:17 PM

Answers

  • Hi,

    Please create a shortcut with the correct command line and publish the shortcut file (.lnk) as the RemoteApp instead of the exe as you have now.  For example, say you have an application installed in C:\MyApp on your RDSH servers, and you want it to have a %CLIENTNAME% as a command line switch.  You would create a shortcut with %CLIENTNAME% in the Target box as appropriate, and then use commands similar to below in an administrator PowerShell prompt on your broker:

     
    Import-Module RemoteDesktop
    New-RDRemoteApp -CollectionName "MyCollection" -DisplayName "MyApp" -FilePath "C:\MyApp\MyApp.lnk" -ConnectionBroker "MyBroker" -IconPath "C:\MyApp\MyApp.exe"
     

    Please note that the shortcut (.lnk file) needs to be on all RDSH servers in the collection, and you are not setting command-line parameters as part of the published RemoteApp properties.  The command-line parameters are coming from the .lnk file instead.  It may be easier to see the correct .lnk file name (to use as part of above ps command) from a command prompt using dir command.

    Thanks.

    -TP


    • Edited by TP []MVP, Moderator Tuesday, December 13, 2016 12:37 AM
    • Marked as answer by KTHSK Tuesday, December 13, 2016 3:29 PM
    Tuesday, December 13, 2016 12:36 AM
    Moderator

All replies

  • Hi,

    Please provide more detail regarding precisely how you are attempting to use %CLIENTNAME%.  For example, is the application itself retrieving the environment variable, and/or are you specifying it on the command line, something else, etc.

    Thanks.

    -TP

    Monday, December 12, 2016 9:23 PM
    Moderator
  • We are specifying it in the parameters section of the published application. 

    Monday, December 12, 2016 11:15 PM
  • Hi,

    Please create a shortcut with the correct command line and publish the shortcut file (.lnk) as the RemoteApp instead of the exe as you have now.  For example, say you have an application installed in C:\MyApp on your RDSH servers, and you want it to have a %CLIENTNAME% as a command line switch.  You would create a shortcut with %CLIENTNAME% in the Target box as appropriate, and then use commands similar to below in an administrator PowerShell prompt on your broker:

     
    Import-Module RemoteDesktop
    New-RDRemoteApp -CollectionName "MyCollection" -DisplayName "MyApp" -FilePath "C:\MyApp\MyApp.lnk" -ConnectionBroker "MyBroker" -IconPath "C:\MyApp\MyApp.exe"
     

    Please note that the shortcut (.lnk file) needs to be on all RDSH servers in the collection, and you are not setting command-line parameters as part of the published RemoteApp properties.  The command-line parameters are coming from the .lnk file instead.  It may be easier to see the correct .lnk file name (to use as part of above ps command) from a command prompt using dir command.

    Thanks.

    -TP


    • Edited by TP []MVP, Moderator Tuesday, December 13, 2016 12:37 AM
    • Marked as answer by KTHSK Tuesday, December 13, 2016 3:29 PM
    Tuesday, December 13, 2016 12:36 AM
    Moderator
  • Thank you very much. That worked awesome!!
    • Edited by KTHSK Tuesday, December 13, 2016 3:30 PM
    Tuesday, December 13, 2016 3:30 PM