WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Terminal Server

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Identify Citrix Server

 Keywords: Citrix Server wtsIsCitrixEnabled ICA Session RDP IMAService Terminal Service Extender

Question:

I am trying to write a script that will be able to determine if the computer running it is a Citrix server. I don't need to know anything about a specific session, and I want it to know that it is a Citrix server regardless of if it is run via an ICA session, RDP, or run from the console. I'm leaning towards querying Add/Remove Programs via WMI to determine if Citrix XenApp 6.5 was installed.

I was curious if anyone had a better idea.

Answer:

Take a look at the Terminal Service Extender. Specifically, it has a function, wtsIsCitrixEnabled(), which can detect the presence and availability of various DLLs that are part of the Citrix product. It should give you exactly what you are looking for.

User Reply:

I was unaware of the wtsIsCitrixEnabled() function, so I've been using the existence of the IMAService as a determinant. Is wtsIsCitrixEnabled() valid for all versions of Citrix? Will it be maintained for future versions of Citrix?

We've also considered putting a registry entry in the build process for Citrix servers so we could check for it in that way.

Answer:

That function was implemented several years ago when the Terminal Services Extender was first created. In all that time since, it hasn't needed any updates or bug-fixes of any significance, if any at all, w/respect to TS/Citrix functionality.

As long as Citrix doesn't change their underlying implementation of API libraries and the DLLs that host them, then it should keep on working OK. Obviously, you would want to test the wtsIsCitrixEnabled() function with each new version of Citrix that you get in order to make sure that it is, in fact, working properly.

If you take a look at the documentation for the wtsIsCitrixEnabled() function, You will see that the different types of information that it can obtain each have their own description of what is examined in order to get the information from a Citrix server. For the most part, those tests could be made manually by inspecting the system and looking for the necessary DLLs and using Dependency Walker to view the exported functions that are present in the DLLs.

User Reply:

The TS extender did the trick. I decided to make all 4 requests via wtsIsCitrixEnabled. A positive response to any of them will label the computer a Citrix server. Probably overkill, but it makes me happy.
Article ID:   W17606
Filename:   Identify Citrix Server.txt
File Created: 2013:03:01:10:00:00
Last Updated: 2013:03:01:10:00:00