Auto launch Citrix published apps in Chrome

Author: | Posted in Citrix No comments

Since Google disabled NPAPI support in Chrome browser XenApp and XenDesktop publications autostart doesn’t work anymore.

The only way to get this functionality back is to enable the “always open files of this type” when you download an ICA as explained here. This has to be done once for each user. To get rid of this anoying work around, you’d have to edit the Chrome’s Preference file for each user.

You can also run the following VBS script in the user context (at logon or in an Active Setup during your next Receiver deployment).

' Set auto launch ICA files in Chrome browser
Set g_objWshShell = WScript.CreateObject("WScript.Shell")
sPrefPath = g_objWshShell.ExpandEnvironmentStrings("%USERPROFILE%") & "\AppData\Local\Google\Chrome\User Data\Default"
Set g_objFSO = CreateObject("Scripting.FileSystemObject")
Set objFileIn = g_objFSO.OpenTextFile(sPrefPath & "\Preferences", ForReading)
sIn = objFileIn.ReadLine()
objFileIn.close()
Set objRegex = new RegExp

'Pattern for auto opened extensions
objRegex.Pattern = "\""extensions_to_open\"":""[^""]*"""
objRegex.Global = True
Set myMatches = objRegex.Execute(sIn)
sFounded = myMatches(0)

'If no extension already parametered
if Instr(sFounded, "extensions_to_open"":""""") Then
                sReplaced= """extensions_to_open"":""ica"""
Else 'If at least on extension parametered
                sExistant = Split(sFounded,"""")
                'if ica extension aready parametered
                if Instr(sExistant(3), "ica") Then
                               'no replacement
                               sReplaced = sFounded
                Else 'add ica to the list of extensions
                               sReplaced= """extensions_to_open"":""" & sExistant(3) & ":ica"""
                End If
End If

'replace the string in the target file
sOut = objRegex.Replace(sIn, sReplaced)
'Kill Chrome.exe
g_objWshShell.Run "taskkill /F /IM Chrome.exe /T", , True
set objFileOut = g_objFSO.CreateTextFile(sPrefPath & "\Preferences",True)
objFileOut.Write(sOut)
objFileOut.close

Add Your Comment

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