Connect with us

Hi, what are you looking for?

Citrix XenApp

How to track application launches on legacy Citrix servers (Presentation Server)

I had a request today to track application launches on an old Presentation Server 4.0 farm so we could get a good picture of application utilization and figure out what apps needed to be migrated to newer XenApp farms and what could be decommissioned. EdgeSight has an excellent “Published Application Launch Summary” report but it it needs the EdgeSight agent to be installed in “Advanced” mode to work. This requires a Platinum license and just my luck, this particular farm had an Enterprise license and all the EdgeSight agents had to be installed in “Basic” mode. So no launch data for me. 🙁

So my solution was to write a quick .vbs logon script to write each app launch to a .txt file on a file share we could monitor. Each launch would append the .txt file. Yeah, it’s a poor man’s Edgesight application launch report but it works in a pinch. Grabbing environmental variables for each session launch was easy, the tough part was grabbing the name of the Citrix application that was launched. For this I turn to Warren Simondson/Ctrl-Alt-Del IT Consultancy and their Getpubapp.exe utility:

http://www.ctrl-alt-del.com.au/CAD_TSUtils.htm

This handy little tool will let you query what app is running in an ICA session. I had to write my script to run the executable first, store the result in a variable, combine it with my environmental variables, and then finally append the output to my text file.

Download Getpubapp.exe and stick it in a file share where all users will have permissions to write to. Create an empty .txt file called PS4launches.txt.

Now create a PSLaunch.vbs file and copy in my script below:

If the code runs off the page above just select all or just copy and paste the script from this .txt file (right click – save as):

PSLaunch.txt

This is a quick and dirty script I figured out and wrote in just a few hours so if you add any cool modifications, please comment below. My output has some key pieces of criteria I was after which were:

-Date
-Time
-Citrix Application Name
-Domain/UserID
-Citrix server name
-Session ID
-Client name

Now it’s just a simple matter of creating a group policy and setting this as a user logon script. I keep the “Session ID” in the output so I can tell the difference between an ICA session and an RDP session initiated by an administrator.

My txt file output looks like this:

1

You’ll notice on the last line is was an RDP session by an administrator logging into the server so there is no published app name. You just get an extra space. If you want to work with the data, import the text file into Excel and use Text to Columns and use the spaces as deliminators. Then you can sort on any column you need.

5 Comments

5 Comments

  1. Morten

    December 10, 2013 at 2:59 AM

    This is great. The only caveat is with session sharing in that only the actually launched application is recorded. Even running getpubapp manually when more published apps had been started only showed the original app.

    Still very useful though. Thanks a lot!

  2. Jason Samuel

    December 10, 2013 at 10:50 AM

    Thanks Morten. You are absolutely right. Getpubapp.exe only returns the result of the first app that was launched in the session. Additionally since the script is set to run at user logon it will only run once when the first app on the server is launched. All subsequent app launches in the same session will not trigger the script. It’s a bit of a limitation. Let me see what I can come up with.

  3. Warren Simondson

    March 3, 2014 at 4:03 AM

    Hi Jason

    That’s a great use of getpubapp.exe. I wrote that exe a long time ago, but I’m interested in what you are doing here. Let me know what you need from it and I might be able to write a modification. There’s certainly no reason why you can’t enumerate the sessions within the session, by enumerating the user sessions against the farm and listing them against the client name. I’d certainly be interested in helping out.

    Cheers

    Warren Simondson

  4. Jason Samuel

    March 3, 2014 at 3:56 PM

    @Warren Simondson
    Hey Warren, thanks for your comment and making getpubapp available! Yes it would be great if it could pass all apps the user opens.

  5. Todd

    June 18, 2014 at 9:59 AM

    This works great for the initial connection. Any ideas for capturing session sharing information?

    Thanks,
    Todd

Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Apache

Today I would like to go over proper URL redirection when using SSL but first I would like to preface this by describing what...

Citrix Workspace

You can use FIDO2 hardware security keys plugged into your physical desktop over the Citrix HDX remoting protocol for use with virtualized Windows Desktop...

Exchange 2003

A useful Exchange 2003 guide I wrote for a friend’s blog originally but I am posting it here on mine now for your viewing...

Apache

In a worst case scenario and all your web servers have failed, what do you do? You could have a standby group of servers...

JasonSamuel.com began in 2008 as a way for me to give back to the IT community. This website features the latest news and how-to's on enterprise mobility, security, virtualization, cloud architecture, and other technologies I work with. This website has evolved over time to become a go-to reference hub for these technologies. It receives hundreds of thousands of unique visitors from all over the world each month. More details on the About Me page.
Copyright © 2008-2023 JasonSamuel.com