Skip to main content
Question

Removing an application using a command or script


Forum|alt.badge.img+4

We have an application installed on all of our Macs called Egnyte Connect which we want to remove. This application was deployed using a pkg via JAMF. Egnyte have given us a command to run their uninstaller.

sudo /Applications/Egnyte\\ Connect.app/Contents/Resources/Egnyte\\ Connect\\ Uninstaller.app/Contents/MacOS/Egnyte\\ Connect\\ Uninstaller

 How can I use this command in JAMF? I tried using it in a script but that didn't work.

#!/bin/bash

sudo /Applications/Egnyte\\ Connect.app/Contents/Resources/Egnyte\\ Connect\\ Uninstaller.app/Contents/MacOS/Egnyte\\ Connect\\ Uninstaller

What's the best way to approach this?

Thanks

11 replies

sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • 3532 replies
  • September 7, 2023

@sparrowhawk When running via Jamf Pro you can omit the sudo as Jamf will already be running the command as an admin.

Since it's a single command to run the uninstall easiest way to run would be via the Execute Command entry in a Files & Processes payload of a Policy. The escaping of the path for the uninstaller looks good, so if that doesn't work please post the log when running the policy so any error it's reporting can be identified.


Forum|alt.badge.img+4
  • Author
  • Contributor
  • 21 replies
  • September 7, 2023
sdagley wrote:

@sparrowhawk When running via Jamf Pro you can omit the sudo as Jamf will already be running the command as an admin.

Since it's a single command to run the uninstall easiest way to run would be via the Execute Command entry in a Files & Processes payload of a Policy. The escaping of the path for the uninstaller looks good, so if that doesn't work please post the log when running the policy so any error it's reporting can be identified.


Hi @sdagley , thanks for your post! I've learned something new here already. I wasn't aware of the Files & Processes ability to run a command, so thanks! I set that up and although it ran the command, the application wasn't removed and there was no result recorded.

Have I set it up incorrectly?


sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • 3532 replies
  • September 7, 2023
sparrowhawk wrote:

Hi @sdagley , thanks for your post! I've learned something new here already. I wasn't aware of the Files & Processes ability to run a command, so thanks! I set that up and although it ran the command, the application wasn't removed and there was no result recorded.

Have I set it up incorrectly?


@sparrowhawk Can you try running the command from Terminal on a Mac with the software installed and see if that works? (you'll need to include the sudo for that) And if it doesn't is there any additional information reported when you run the uninstaller that way?


Forum|alt.badge.img+4
  • Author
  • Contributor
  • 21 replies
  • September 7, 2023
sdagley wrote:

@sparrowhawk Can you try running the command from Terminal on a Mac with the software installed and see if that works? (you'll need to include the sudo for that) And if it doesn't is there any additional information reported when you run the uninstaller that way?


I've already tested that and it works when run locally.


sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • 3532 replies
  • September 7, 2023
sparrowhawk wrote:

I've already tested that and it works when run locally.


What happens if you run the uninstaller without the sudo? And are all of your user accounts Admin accounts, or are they Standard accounts?


Forum|alt.badge.img+4
  • Author
  • Contributor
  • 21 replies
  • September 7, 2023
sdagley wrote:

What happens if you run the uninstaller without the sudo? And are all of your user accounts Admin accounts, or are they Standard accounts?


Do you mean run the command locally without sudo? Our standard accounts aren't admins.


Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • September 7, 2023
sparrowhawk wrote:

Hi @sdagley , thanks for your post! I've learned something new here already. I wasn't aware of the Files & Processes ability to run a command, so thanks! I set that up and although it ran the command, the application wasn't removed and there was no result recorded.

Have I set it up incorrectly?


If I had to guess, this command probably only works in a user context, since it's an executable from the app bundle. It probably launches an app that needs to be responded to to complete the uninstallation. Some other apps work this way too, like the uninstaller for Cisco AnyConnect.
Is that the case when you run it locally on a device instead of from a Jamf Pro policy?


Forum|alt.badge.img+6
  • Contributor
  • 12 replies
  • September 8, 2023

Hi,

try this as script

#!/bin/bash

# Check if Egnyte Connect is installed
if [ -e "/Applications/Egnyte Connect.app" ]; then
# Uninstall Egnyte Connect
sudo /Applications/Egnyte\\ Connect.app/Contents/Resources/Egnyte\\ Connect\\ Uninstaller.app/Contents/MacOS/Egnyte\\ Connect\\ Uninstaller
echo "Egnyte Connect has been uninstalled."
else
echo "Egnyte Connect is not installed on this system."
fi

exit 0



sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • 3532 replies
  • September 8, 2023
mm2270 wrote:

If I had to guess, this command probably only works in a user context, since it's an executable from the app bundle. It probably launches an app that needs to be responded to to complete the uninstallation. Some other apps work this way too, like the uninstaller for Cisco AnyConnect.
Is that the case when you run it locally on a device instead of from a Jamf Pro policy?


@sparrowhawk Any response to @mm2270 's question regarding user interaction when running the uninstaller locally? That would definitely impact attempting to run the removal via a script.


Forum|alt.badge.img+4
  • Author
  • Contributor
  • 21 replies
  • September 11, 2023
sdagley wrote:

@sparrowhawk Any response to @mm2270 's question regarding user interaction when running the uninstaller locally? That would definitely impact attempting to run the removal via a script.


Hi @sdagley  and @mm2270, I've been on leave for a few days. The command runs silently and doesn't require any user interaction.


Forum|alt.badge.img+4
  • Author
  • Contributor
  • 21 replies
  • September 11, 2023
Deku91 wrote:

Hi,

try this as script

#!/bin/bash

# Check if Egnyte Connect is installed
if [ -e "/Applications/Egnyte Connect.app" ]; then
# Uninstall Egnyte Connect
sudo /Applications/Egnyte\\ Connect.app/Contents/Resources/Egnyte\\ Connect\\ Uninstaller.app/Contents/MacOS/Egnyte\\ Connect\\ Uninstaller
echo "Egnyte Connect has been uninstalled."
else
echo "Egnyte Connect is not installed on this system."
fi

exit 0



Hi @Deku91, you've cracked it! I just had to add a pkill "Egnyte Connect" as the application can't be running and setting the script to launch at login wasn't quick enough. The notifications didn't pop up, but I'm not worried about those.

Thanks all. I love JAMFNation, you guys rock! ðŸ¤˜


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings