• Welcome to Support Forum: Get Support for Patch My PC Products and Services.

Create uninstall script for citrix HDX

Started by Matthias Veelaert, March 17, 2022, 03:38:10 AM

Previous topic - Next topic

Matthias Veelaert

Hi there,
I have just started at Lineas and they work with patchmypc so im learning as I go along. Now there is a product called citrix which you support. We're trying to go back from the 2202 workspace release to the 19.12 workspace ltsr version but before we can delete workspace 2202, we have to delete Citrix HDX. Then we install the other citrix workspace and then reinstall HDX. Now I have written a line to first delete HDX in a script but It looks like it doesn't want to execute. I have added this script to pre/post scripts but I don' know if I am doing something wrong. The line I have written can be found in the attachments. Am I doing it right or am I missing something?

Kind regards!

Adam Cook (Patch My PC)

Hey Matthias,

Unfortunately we can not provide support for writing custom scripts.

My advice is to avoid querying the Win32_Product WMI class as this forces every product on the system to reconfigure/reinstall itself. Here's an article I found online you might find useful for more reading on that: https://xkln.net/blog/please-stop-using-win32product-to-find-installed-software-alternatives-inside/

Matthias Veelaert

Alright, thanks I'll definitely look into it :) Thank you

Matthias Veelaert

Do the scripts get executed as admin when they get added to scripts in patchmypc?

Adam Cook (Patch My PC)

They execute in the same context as the apps/updates which is generally NT AUTHORITY\SYSTEM, unless you choose a user-based app then it'll execute in the user's context.

Matthias Veelaert

Where would I find out if its a user-based application? Also the script wont execute even though the script itself works. Do you perhaps have an idea why the script wont execute when citrix is being uninstalled? I have stopped querying win32 though :)

Adam Cook (Patch My PC)

Products in our catalogue with the naming convention of "... (User)" in the title would be user-based packages.


Hi, I tried running this,
C:\ProgramData\Citrix\Citrix Receiver 4.11\TrolleyExpress.exe /uninstall /silent /cleanup

J Wick


I'm at this point as well right now.

For Citrix Receiver, there is a pretty good clean up tool, which doesn't care if it was installed as user or system: https://support.citrix.com/article/CTX137494/receiver-cleanup-utility

A little bit difficult is detecting user installations and running system uninstallation
Maybe something like this would work:
Application1 (dummy application, does nothing at all) running as user with detection script like
if ((Get-ChildItem -path $env:localappdata\Pathto\Citrix\Receiver.exe -ErrorAction SilentlyContinue).exists) {Write-Host "True"}Application2 superseding Application1 also running as user and creates a dummy file where user can write to (like c:\temp\citrix.tmp)
if ((Get-ChildItem -path c:\temp\citrix.tmp -ErrorAction SilentlyContinue).exists) {Write-Host "True"}Application3 deployed as system with detection c:\temp\citrix.tmp does not exist
if (!(Get-ChildItem -path c:\temp\citrix.tmp -ErrorAction SilentlyContinue).exists) {Write-Host "True"} and running Cleanuptool and deleting citrix.tmp file

not tested... just some brainfarting ;)

For Citrix Workspace, there is no such tool