Search code examples
citrixxenapp

How do I detect if XenApp Client is installed on user machine?


We are upgrading from Citrix Metaframe to XenApp, and I need to know if there's a way to programmatically detect if the XenApp Web Plugin v11.0 is already installed on a client machine when it contacts our webserver for login -- this was previously done for the Metaframe Web Client by attempting to instantiate the ICA client in an ASP script, which used the results to determine whether to offer the client as a download/install.

The current code for this detection is:

Set icaObj = CreateObject("Citrix.ICAClient")

The above code does not find the XenApp plugin.


Solution

  • I continued my research after posting this question and I finally found the answer. Only 3 views on this question since I posted it, but despite the disinterest I believe I should answer my question, "Just in Case" someone else has this problem.

    I was mistaken in my statement in question that the code I posted didn't find the XenApp plugin. In fact, it does. It returns a valid object in the presence of both Metaframe and XenAppWeb. I posted this question on Citrix's own forums, and no answers there either.

    What I did to find the answer was to create a VS2008 project to which I added a COM reference to the Citrix ICA library -- both of them, installed separately one at a time. I found that both had a COM library named WFICALib, and searched through both of them to see if there was something that might distinguish them. What I found was a property, ClientVersion, which was 9.0.xxx for Metaframe, and 11.0.xxxx for XenAppWeb.

    BINGO!

    From this I cut the following code to return the version as a function in VBScript:

    Function GetVer()
        Dim icaObj, Ver
        On Error Resume Next
        Set icaObj = CreateObject("Citrix.ICAClient")
        if err.number = 0 then
            if IsObject(icaObj) then
               GetVer = icaObj.ClientVersion
            else
               GetVer = 0
            end if
            set icaObj = nothing
        else
            GetVer = 0
        end if
    End Function
    

    ADDENDUM:

    Since posting this answer, I have discovered that this script in the newer versions of Internet Explorer (e.g. IE9) is not reliably detecting the plugin -- sometimes it worked, and other times not! What I did to fix the problem was to switch the script to JScript instead of JavaScript, and the new version looks like this:

    <script type="text/jscript">
        function GetCitrixVersion() {
            try {
                var icaObj = new ActiveXObject("Citrix.ICAClient");
                return icaObj.ClientVersion;
            }
            catch (e) {
                return 0;
            }
        }
    </script>
    

    Note the script type is text/jscript, not text/javascript.