• Category Archives Appcenter
  • Wfica32 Application State “Application not running” workaround

    Recently I ran into an issue with double hop ICA session from a XenApp server. For those not aware of this, this is a situation where you launch xenapp from a local farm and connect to another farm through that XenApp session, hence Double Hop.

    The issue is that with changes in Windows 2008 architecture, when processes are changed. In the Citrix Management Console this represents itself as Application Status “Application not running” and no Application name listed. This will prevent XenApp application limits from taking hold.

    This issue is very similar to the Citrix KB article here documenting a resolution on how to use VBscript to launch Internet Explorer. I tried that resolution and in my case it did not fix the issue. I was launching wfica32.exe to launch a remote session using an ICA file. Even when launching wfica32.exe as a published application with no script, I saw the above symptoms.
    I found that if I put a pause and hid the script with ctxhide.exe as long as the script was running it would show the Application name and the correct Application State but this caused a different issue, user would close the double hop ICA application and the script would stay resident keeping the session open until it idled out and giving the user the idle timeout warning well after the user closed the actual session. This simply will not work so back to the drawing board.

    This message also cannot be turned off as documented here.

    So my resolution was to come up with a way to detect if the process was running or not running and logoff the session based upon that. I tried several methods but wanted to keep it simple (KISS principle) so I stuck with the batch file that I was already using to launch the file anyway and added error detection into that script using tasklist to detect if the process was running.
    It is published with the following app settings in Xenapp
    ctxhide.exe C:adminapplaunch.cmd ICAfile.ica
    The Script
    REM —Copy all of this text into a notepad and save it as a batch file

    REM —to see if a program is running
    @echo off

    sleep 1
    REM – This will launch the ICA file. Publish the App in XenApp and call the paramater for the ICA file in c:Admin

    “C:Program Files (x86)CitrixICA Clientwfica32.exe” c:admin%1

    sleep 30

    set runningprocess=wfica32.exe
    rem —- 1: all one line —-
    tasklist /FI “IMAGENAME eq %runningprocess%” /FI “Username eq %username%” | find /I “%runningprocess%” > nul
    rem —- 1: end of line
    IF %ERRORLEVEL% equ 0 echo %errorlevel%
    IF %ERRORLEVEL% equ 1 logoff
    sleep 300
    goto loop

     This script should be pretty easy to edit. Tasklist does not provide errorlevel so I used find to find the process and create the errorlevel. The script will stay resident until the wfica32.exe process is closed and within five minutes of ending the remote ICA session under that user context it will then do a logoff for that user.