Citrix Receiver Cleanup

For years Citrix has created the Receiver installer with per-user installation functionality where if the installer is launched in the context of a regular user it will install/register the components to the local user’s profile rather than just failing with a permission error. This creates a huge headache when trying to mass deploy Receiver (now Citrix Workspace) to the environment. You wind up with machines that have both installed. When this happens the user that had the per-user installation cannot launch applications. Even worse the machine/profile usually winds up being in a state where the per-user installation cannot be removed. Even if you get it removed the uninstaller and Citrix’s own cleanup utilities do an awful job at cleaning up the registered classes/components in the per-user installation. Their tools only clean up a fraction of what is actually there. My last two work environments (and current) have been plagued with these installations. I spent time a while back figuring out how to clean it up manually, but it is a major headache to do so. I tried logging a case (and an enhancement request) with Citrix about two years ago stating their ‘Receiver Clean-up Utility‘ utility does not properly clean up these installations. They later came back saying they no longer are supporting the utility. It seems that since then they’ve updated the utility to clean installs up to version 4.3.

Cleanup

Uninstall Citrix Receiver or Citrix Workspace from Apps and Features. Run Citrix Cleanup program Citrix Receiver/Workspace Cleanup Utility Install Citrix Workspace. Citrix has a cleanup utility to completely uninstall all files and registry entries for Citrix Receiver. Citrix says that the newer versions of Citrix Receiver (v4.4 and later) no longer need the ReceiverCleanupUtility. However, we’ve found instances where the ReceiverCleanupUtility is the only thing that helps. Here are the steps involved.

Citrix receiver cleanup utility download

'C: Program Files (x86) Citrix ICA Client SelfServicePlugin CleanUp.exe' -cleanUser' GUI Method. Right click the Receiver icon in the notification area and select Advanced Preferences. In the dialog, select Reset Receiver and click OK. Quick shout out to Trishanka Saikia from Citrix Technical Support for this info. Citrix does not recommend that you use the Receiver clean-up utility to uninstall Citrix Workspace app for Windows (Store). Citrix Workspace app desktop clean-up tool. The Citrix Workspace app desktop clean-up tool allows you to delete the desktop shortcuts that remain after you uninstall Citrix Workspace app for Windows (Store).

Citrix Receiver Cleanup

Let’s take a look what Citrix is missing in their utility… To do this I take a clean profile, install Citrix Receiver 4.3.100 (not elevated/per-user install), and uninstall it using the Receiver Clean-up Utility (running as an administrator/elevated) while the regular user is still logged in and has their profile loaded. Here is a high-level list of what was left behind in the registry:

  • HKCUSoftwareClasses* – File Associations and COM object registrations
  • HKCUSoftwareClassesAppID* – AppID registrations
  • HKCUSoftwareClassesApplications* – More app registrations
  • HKCUSoftwareClassesCLSID* – MANY COM class object GUIDs
  • HKCUSoftwareClassesWOW6432NodeCLSID* – MANY COM class object GUIDs (32-bit)
  • HKCUSoftwareClassesInterface* – MANY interface name to interface ID mappings
  • HKCUSoftwareClassesWOW6432NodeInterface* – MANY interface name to interface ID mappings (32-bit)
  • HKCUSoftwareClassesMIMEDatabaseContent Type* – x-ica MIME types
  • HKCUSoftwareClassesPROTOCOLSFilter* – Protocol filter handlers
  • HKCUSoftwareClassesRecord*
  • HKCUSoftwareClassesTypeLib*
  • HKCUSOFTWAREMozillaPlugins* – Firefox plugin registrations
  • HKCUSoftwareMicrosoftInstallerProducts – MSI installer product codes

In addition to this there are other issues:

  • When it is run against a machine it doesn’t properly load other existing (unloaded) profiles. This caused it not to fully process other user profiles on the machine
  • It doesn’t always kill processes correctly leaving file/directories behind

I decided to build a wrapper script around the Citrix Receiver Clean-up Utility to fill in the gaps. To do so I had to create a full list of everything I had to target. I decided to extract the MSIs from the installer I was testing with and dissect them. I used SuperOrca to pull the ‘Registry’ table from each MSI. I imported those into Excel and used filtering/VLOOKUPs to extract what I needed.

After chopping up the data I am left with the following groups of items to target:

  • A static list of unique registry keys under the user’s profile (this is a good start, but I noticed that some of the IDs in CLSID and Interface are different between versions)
  • A list of values to search for under ‘HKCUSoftwareClassesCLSID’ in order to determine of the root key should be deleted. Also need to target the WOW6432Node path
  • A list of values to search for under ‘HKCUSoftwareClassesInterface’ in order to determine of the root key should be deleted. Also need to target the WOW6432Node path
  • A list of values to search for under ‘HKCUSoftwareMicrosoftInstallerProducts’ in order to determine of the root key should be deleted. The clean-up utility cleaned up most of this, but one was left over for me

Now that I have the targets it’s time to write the script. In addition to targeting the various registry locations I want to:

  • Identify and load all profile registry hives. This will allow me to run my clean-up process against all profiles, but it will also allow the clean-up utility to process them without the having to be logged in
  • Kill processes that reside in certain paths using wildcards
  • Execute the Citrix Receiver Clean-up Utility silently
  • Clean up a static list of registry keys in all user profiles
  • Search for a list of value strings under in the ‘CLSID’ keys and delete the parent key if a match is found
  • Search for a list of value strings under in the ‘Interface’ keys and delete the parent key if a match is found
  • Search for a list of ‘ProductName‘ value strings under in the ‘InstallerProducts’ keys and delete the product key if a match is found
  • Unload all registry hives that were manually loaded in the first step
  • I also wanted the script to work with older versions of PowerShell. I did my best to make it compatible with PS V2

I have tested the script with multiple versions and so far it is working well. It does require that you download the ‘Receiver Clean-up Utility‘ and place the executable in the same directory as the script. Feel free to submit any issues here or in the GitHub repository.

GitHub link: https://github.com/markdepalma/CleanPerUserReceiverInstall

Receiver Cleanup Utility:

You might want to uninstall existing receiver version and install same version or a newer version of citrix receiver in user’s machine. In this case, you can uninstall citrix receiver directly from add or remove programs but that might leave some registry keys, and folders back. So, it is always recommended to use citrix receiver cleanup utility to remove existing citrix receiver from a user’s machine.

Receiver cleanup utility is available for download from citrix support site, but each citrix receiver setup has receiver cleanup utility in it. Use software like 7 zip to extract contents of citrixreceiver.exe to a folder. You will find receiver cleanup utility in it. You don’t have to download it separately and juggle with different recievers and different receiver cleanup utility versions. You can run it silently using below command: ReceiverCleanupUtility.exe /silent.

After you extract citrixreceiver.exe to a folder, you can see receivercleanup utility as shown below:

Citrix Receiver Cleanup Utility For Mac

Run it with admin rights and reboot once done. Install latest receiver as needed once rebooted. Always backup registry before you run any tool. For more information on how to use this tool, check this link: https://support.citrix.com/article/CTX137494

VDA Cleanup Utility:

If you have to reinstall VDA software in user’s citrix VM, you can start doing it from add or remove programs. In case you end up in errors that some components are not deleted, you can use vda cleanup utility from citrix. You can run it silently using below commands:

Citrix Receiver Clean-up Utility

Citrix Receiver Cleanup
  • VDACleanupUtility.exe /silent
  • VDACleanupUtility.exe /noreboot
  • VDACleanupUtility.exe /silent /noreboot
  • VDACleanupUtility.exe /unattended

For more information on how to use this tool, go through the article given here: https://support.citrix.com/article/CTX209255

Citrix Receiver Cleanup User

Note: Always check if there are new versions of these tools available in citrix support sites.

Comments are closed.