Auto launch Citrix published apps in Chrome

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.

chromeautolaunch

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
Advertisements

Citrix, mobility & virtualization @Work / father, husband & geek @home

Tagged with: , ,
Posted in Citrix
2 comments on “Auto launch Citrix published apps in Chrome
  1. philbert says:

    why do I get: Microsoft VBScript runtime error: Object required: ‘g_objWshShell’

    • jeromequief says:

      You’re right. I forgot to declare the shell object. I modified the article with the missing line at the beginning of the script :
      Set g_objWshShell = WScript.CreateObject(“WScript.Shell”)
      Thanks for mentioning 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: