Fixing Citrix Receiver – duplicate icons and stores

When moving from one storefront server to another I’ve experienced that Citrix Receiver gets multiple stores and multiple icons after switching to the new server using the same DNS name. Here is what’s happening and how to avoid it and fix it.

Storefront has a unique service record ID that is generated during configuration. When you configure a new storefront server the SRID will be new a unique ID. If you have a different SRID you will experience multiple stores and icons on your Citrix Receiver clients that has been previously configured with a storefront address. To avoid it, you can change the SRID on the new Storefront server to be the same as on the old Storefront server. To do this open c: \inetpub\wwwroot\Citrix\Roaming\web.config and search for SRID.

Change the SRID on the new storefront server to be the same as on your old storefront server. If you have multiple load balanced storefront server, you have to do it on all storefront servers.

Next open c:\ \inetpub\wwwroot\Citrix\Store\web.config

Search for SRID and replace it the same way here:

After this is done you can now go ahead and change the DNS record for your storefront server to point to the new storefront server or storefront load balanced address.

If you already have got clients with multiple stores and icons, it could be hard to fix this, and here is why:

The reason is that the SRID for storefront is located multiple places in registry on the client machines and they are connected to each other in a strange way.

HKEY_CURRENT_USER\Software\Citrix\Receiver\SR\Store\<srid>

HKEY_CURRENT_USER\Software\Citrix\Receiver\CtxAccount\<uniqueid>\<srid>

HKEY_CURRENT_USER\Software\Citrix\Dazzle\Sites\<uniqueid>

 

At startup, receiver will look at the CtxAccount key and if it finds a SRID that is not existing under Dazzle\Sites, it will create a new instance here and under store. Under store the new SRID is adopted but under dazzle\Sites the old SRID is used causing it to create a new store reference in receiver every time it starts up. This will aggregate duplicate app icons at the Citrix receiver client.

To stop this crazy behavior, you need a very clever script.

The script needs to kill Citrix Receiver first, because receiver keeps the settings in memory and will overwrite the reg keys from the script at shutdown.

We need to search for all instances that has the incorrect SRID and remove all keys connected to that SRID. Then under Dazzle\Sites we need to remove all instances of the correct SRID except for the first. In this way we will keep one reference to the store.

Here is my attempt to create such a script. If you want to use it, please test it first, and remember that the use of this script is completely on your own risk.

 

'Script to cleanup Citrix Receiver Stores from client machines. Please change SRID value to the SRID that you want to keep.

 

on error resume next
SRID="1234567890"
Const HKEY_CURRENT_USER = &H80000001
Set objShell = WScript.CreateObject("WScript.Shell")
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")

 

'Kill citrix receiver
objShell.Run "taskkill /im:ssonsvr.exe /f", 1, true
objShell.Run "taskkill /im:pnamain.exe /f", 1, true
objShell.Run "taskkill /im:wfcrun32.exe /f", 1, true
objShell.Run "taskkill /im:wfica32.exe /f", 1, true
objShell.Run "taskkill /im:SelfService.exe /f", 1, true
objShell.Run "taskkill /im:SelfServicePlugin.exe /f", 1, true
objShell.Run "taskkill /im:AuthManSvr.exe /f", 1, true
objShell.Run "taskkill /im:Receiver.exe /f", 1, true

 

'First cleanup dazzle key, keep only 1
oReg.EnumKey HKEY_CURRENT_USER, "Software\Citrix\Dazzle\Sites", arrSubKeys
i=0
For Each subkey In arrSubKeys
    mySRID=objShell.RegRead("HKEY_CURRENT_USER\Software\Citrix\Dazzle\Sites\" & subkey & "\serviceRecordId")
    if mySRID <> SRID then
        objShell.RegDelete ("HKEY_CURRENT_USER\Software\Citrix\Dazzle\Sites\" & subkey & "\")
    end if
    if mySRID = SRID then
        if i=0 then
        else
            objShell.RegDelete ("HKEY_CURRENT_USER\Software\Citrix\Dazzle\Sites\" & subkey & "\")        
        end if
        i=i+1
    end if
Next

 

'Second cleanup ctxaccounts key
oReg.EnumKey HKEY_CURRENT_USER, "Software\Citrix\Receiver\CtxAccount", arrSubKeys
For Each subkey In arrSubKeys
    oReg.EnumKey HKEY_CURRENT_USER, "Software\Citrix\Receiver\CtxAccount\" & subkey, arrSubKeys2
    For Each subkey2 In arrSubKeys2
        if subkey2 <> SRID and subkey2 <> "" then
            objShell.Run "REG DELETE HKCU\Software\Citrix\Receiver\CtxAccount\" & subkey & " /F", 1, true
        end if
    next
Next

 

'Third cleanup Store key
oReg.EnumKey HKEY_CURRENT_USER, "Software\Citrix\Receiver\SR\Store", arrSubKeys
For Each subkey In arrSubKeys
    if subkey <> SRID and subkey <> "" then        
        objShell.Run "REG DELETE HKCU\Software\Citrix\Receiver\SR\Store\" & subkey & " /F", 1, true
    end if
Next

Leave a Reply

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

*