December 5, 2010

I need a solution for indirectly publishing an application on Citrix Presentation Server (using shortcuts!)

*Update* 30/07/2017 : This article was originally done on Citrix Presentation Server, the referenced Citrix article has been updated to XenApp 5.0, I believe it should still work for later versions of Citrix as theory should still be the same. Give a shoutout in the comments if you have tried this recently on newer XenApp versions and still works!

This was an interesting case. An application team approached me to publish their application client using our Citrix Presentation Server. In most cases, we will collect some basic information on the application client like
  1. the estimated max no. of concurrent application users
  2. active usage period
  3. client process load
  4. usage within/outside office environment (for separate Citrix farms)
However, this application's client had a special requirement - it needs to locally access the application's backend data warehouse, there was no way to redirect the access if the data warehouse was housed on a separate server.

The initial idea was to either
  • setup Presentation Server and client on the application data warehouse server, or
  • install the dataware house and client on our Citrix servers.
Customer's internal policy is to segregate their Citrix and application servers, so it was going to involve lots of levels of approval either way.

While looking for alternatives, I tried publishing the client from the application server, but that did not work. Later, I found a Citrix documented method to publish an application using a shortcut. This assumes the client and shortcut are in the Presentation Server.

The first method using a batch file did not work. The second method using a vbs script also did not work initially - having the client shortcut in the Presentation Server and referencing the unc path to the client in the application server failed.

Then, I had another idea - I created the client shortcut in the application server. Instead of using absolute path in the script, I modified using UNC path to the shortcut and this worked beautifully!

A few round of tests with no issues and I proposed this method which was accepted. So far, the application team has been using without any complaints.

I modified from Citrix's documented method: CTX966450 - How to Publish an Application Using a Shortcut (.lnk file)

Requirements
  • Citrix Presentation Server to publish a vbs script
  • Application server hosting the client application

Steps
  1. Create the shortcut to the application in the application server
  2. Create the vbs script below in the Presentation Server

    On Error Resume Next
    Dim sAppPath
    Set WshShell = WScript.CreateObject("WScript.Shell")
    ' Path to the shortcut
    sAppPath = "%comspec% /c [UNC path to shortcut]"
    ' Executes the program then closes the script.
    Return = WshShell.Run(sAppPath, 1, false)
    Wscript.quit


  3. Publish the vbs script with settings
    Command line: c:\windows\system32\wscript.exe "UNC PATH to shortcut"
    Working directory: c:\windows\system32\



The original script from Citrix uses absolute path. I have modified it to use UNC path. For more background story, refer above.



No comments:

Post a Comment