Friday, 30 November 2012

Citrix XenApp Publishing Windows Explorer

We are in the process of upgrading our Citrix farm from XenApp 5 on Windows 2003 to XenApp 6.5.  One of our requirements was to publish a seemless windows version of Explorer.  In Windows 2003 this was easy, but since Microsoft decoupled explorer from IE and now whenever explorer.exe is called, the launched instance now exits and opens a new instance two problems occur.

1. The XenApp AppCenter does not think the launched application is working anymore so you do not see information under connected users

2. As soon as the session starts, it closes down again unless another process is holding it open!

There are many solutions to this availble, but none quite did the trick for me as all the ones I tried had limitations.

With a combination of a batch file, sleep.exe and hstart.exe I was able to not only get the session to stay alive while explorer was running, but also show the correct info in the AppCenter and logoff correctly when explorer was closed.

The published application should look like this:

%path%\hstart64.exe /NOCONSOLE %path%\ExplorerStart.bat

The batch file looks like this:

@echo off
ECHO Starting explorer
ECHO Checking for explorer.exe
TASKLIST /FI "USERNAME eq %userdomain%\%username%" /FI "Imagename eq explorer.exe" > %temp%\explorercheck.txt
ECHO Sleeping for 30 seconds
%path%\sleep.exe 30
set folder=%temp%\explorercheck.txt
for /f "eol=: tokens=3 delims= " %%a in ('find "explorer.exe" %folder%') do (

ECHO Explorer not found so deleting text file and exiting
del  %temp%\explorercheck.txt

I imagine there are more elegant ways of writing the batch file, but this works nicely for me.

%path% needs to be substituted for a real path in three locations.

Hope this saves someone a bit of time.

Thursday, 12 April 2012

AppV Unload All Apps

I have been having an issue where AppV is writing absolutely loads of temporary files in C:\ProgramData\Microsoft\Application Virtualization Client\SoftGrid Client\AppFS Storage. In fact I had >6000 temporary files for each every application on my RDSH servers - two files are created for each and every user who loads the application, each and every time they logon to the server (as I use mandatory profiles). This soon starts to chew up even large system drives. None of the normal methods of clearing the AppV cache empty this area. In fact the only command I found that did was SFTMIME /UNLOAD. Granted you could write a script to manually delete these files, but I wanted to use a supported method.

Using SFTMIME to unload all the apps turned out to be easier said than done due to the number of parameters that need to be sent and all the annoying spaces in file paths and application names. Anyway I wrote a really convuluted process which works great and thought I would share.