Application Streaming and SoftGrid - dual mode

citrix_communities_header The was another great post up on the Citrix site that  I really wanted to share that Joe Nord wrote up. It was specifically around using SoftGrid and Citrix Application Streaming. Its great to see so many from Citrix enjoying SoftGrid as a complementary technology to there own solutions.

----------------------

Application Streaming shares the publishing infrastructure with the rest of XenApp™ (the new name Presentation Server).  Whether the application is published as "Stream to Server", "Stream to Desktop"  or "Streamed for off-line usage",  the publishing infrastructure for Application Streaming is the same as for traditional server hosted applications.   It has been around for years, customers like it and it works. 

SoftGrid® (Microsoft Application Virtualization) can also be published for execution on a Citrix infrastructure.  The server side case is the most common, but SoftGrid can also be executed on a connected desktop system and published via Citrix.    One method of running SoftGrid streamed to desktop is by publishing the package as "content".

  • Access Management Console: Publish application, application type as "content".   The ".SFT" file is the content. 
  • User launches the Citrix published "app" and the SoftGrid client kicks in via File Type Association to run the sequence.
  • There are some "gotchas" such as what if the SoftGrid client isn't available, but it works. 

Dual-mode is what makes things interesting.   Dual-mode streaming

A real value of the Citrix Application Streaming solution is dual-mode streaming.  Since the publishing system and execution system communicate, it is possible to attempt to stream, but automatically fallback to a server side execution if streaming is not possible.   If the client execution system includes the Streaming Client and if all the pre-launch requirements on that machine are met, the application will be streamed.  If client side launch requirements are not met, then the application will be delivered via ICA connection to XenApp.  The user get's their application delivered on the optimal execution platform. 

This capability is normally associated only with the Application Streaming feature of XenApp and is a good plus for administrators.  It is possible to implement dual-mode for SoftGrid as well and the remainder of this post describes how to do it.   The key is scripts. Scripts are your friends

Application Streaming scripts are powerful.   Scripts are not text - they are binary and are "anything" that can be run using the Win32 CreateProcess() API.   This includes BAT, CMD, VBS, EXE and perhaps even MSI, though I can't conclude a good use for that last one.    Scripts can be run BEFORE application execution or AFTER the application terminates and can be run inside or outside of isolation.  There can be numerous scripts per profile and scripts can even be stuff that is not directly executable such as data or DLLs.  The important item here is that scripts travel with the profile and can be run "outside isolation". 

To achieve dual-mode Citrix streaming with the SoftGrid agent, a few steps are needed.

  1. A pre-launch script run outside of isolation to confirm the presence of the SoftGrid client
  2. An application that does nothing should be used as the application to run.  A BAT file with "exit" in it would do the job though an improved version would be a Windows GUI .EXE which has no actual display and just terminates.   Being a GUI app, no command prompt window will come up and go away, so the flicker will be avoided.  For the remainder of this document, I will call this application "DoNothing.exe".
  3. A post-exit script needs to be created that kicks off the SoftGrid client. 

The Streaming Client generally considers scripts to be a short lived operation.  The idea is that prelaunch scripts are quick, the application takes a long time to execute and then the post-exit clean up can occur, which is also quick.   To get dual-mode SoftGrid, we have to change that timeline so we spend almost no time on prelaunch ("1") and running the published application ("2")  and  then most of the time executing the post-exit script.   Conveniently, the streaming client is patient and places no time limits on how long a post-exit script can take to execute.   

The job of the pre-launch script is to verify the presence of the SoftGrid client.  If it's there, return code should be set to 0 and the Streaming Client will proceed to launch DoNothing.exe.   If the SoftGrid client is not present, the Pre-Launch script should return non-zero (aka one) and this will trigger a fallback for dual-mode streaming.  This assumes that the application was published for dual-mode in the Access Management Console. 

The last step is the post-exit script that actually triggers the execution of the SoftGrid agent to run the application.  This script would be added to the profile along with the pre-launch script and both would work to manage the SoftGrid based operation.  In a simple form, the post-exit script would be the .SFT file and file type association can take over to run the sequence.   

Making it elegant

A more elegant solution will pass the name of the sequence to run as a parameter during publishing in the Access Management Console.  This way, a single Application Streaming profile could be used to publish an unlimited number of softgrid sequences.  The name of the application shown to the user and the icon can be adjusted in the AMC and the parameter to specify the SoftGrid sequence to launch can be specified during publishing. 
When the parameter arrives at "DoNothing.exe", it must store the parameter away so it can be accessed during the post-exit script.   I haven't implemented this elegant version, but it should work. 

If sounds interesting please give it a go and post back your results, I'll watch this space to help cover the gotcha cases. 

Joe Nord

Product Architect - Application Streaming Citrix Systems, Fort Lauderdale, FL