Uninstalling Software using a policy and Self Service

mcsoellner
New Contributor III

My company just recently purchased jamf and I am the technical lead for deploying it out to our end users. I went through training with a jamf engineer. He informed that you can create a policy that can uninstall a piece of software in self service and we did that with Google Chrome as an example. When I tried setting it up with Firefox, I could not find the option to uninstall the software again. I have attached what the Google Chrome settings look like. When I try with Firefox, I only receive the install, cache, or install cached options.

Could someone help me out? I can't remember how we did it the first time.

Thanks!

a7b73804ecdd43aa9bfcf1bd308edef3
b56375161285402e9d50fe22efbfddca

1 ACCEPTED SOLUTION

Chris_Hafner
Valued Contributor II

There are a few ways to deal with this. I tend to follow @Look 's recommendation of making anything I want to regularly uninstall an indexed .dmg (Create .dmg with Composer, upload to Casper Admin, Index the .dmg and then check "Allow package to be uninstalled). Then, you will be able to select "Uninstall" in the policy (In addition to Install, Cache and Install cached). The big trick here is that you HAVE to use indexed, dmg's. If you want to use a .pkg or company supplied installer package you could:

• Run a manufacturer uninstaller package
• Run a script that removes the software and files you wish to remove, which is often far more precise than simply letting the JSS remove whatever you had created in Composer.

In this case, I suspect that either creating an indexed .dmg and running an uninstall policy or creating your own script would make little difference unless you had specific needs upon removing Chrome. I'd prefer to leave any user settings personally so simply nuking the application itself should suffice.

View solution in original post

12 REPLIES 12

mpermann
Valued Contributor II

@mcsoellner did you index the Firefox package after you uploaded it to your distribution point in Casper Admin? The package needs to be indexed to be able to uninstall it.

strider_knh
Contributor II

You will also need to be careful with app updates. Your uninstall option might not remove everything if an update has run and places files that the uninstaller does not know about.

Answer to this: Like always, keep it in mind and test.

Look
Valued Contributor III

The package has to be a DMG and it has to be indexed.
Also if your good at scripting you might just find it easier to do it that way and if your not good at scripting, start learning now!

Chris_Hafner
Valued Contributor II

There are a few ways to deal with this. I tend to follow @Look 's recommendation of making anything I want to regularly uninstall an indexed .dmg (Create .dmg with Composer, upload to Casper Admin, Index the .dmg and then check "Allow package to be uninstalled). Then, you will be able to select "Uninstall" in the policy (In addition to Install, Cache and Install cached). The big trick here is that you HAVE to use indexed, dmg's. If you want to use a .pkg or company supplied installer package you could:

• Run a manufacturer uninstaller package
• Run a script that removes the software and files you wish to remove, which is often far more precise than simply letting the JSS remove whatever you had created in Composer.

In this case, I suspect that either creating an indexed .dmg and running an uninstall policy or creating your own script would make little difference unless you had specific needs upon removing Chrome. I'd prefer to leave any user settings personally so simply nuking the application itself should suffice.

donmontalvo
Esteemed Contributor III

The word "Uninstaller" is a little misleading, unless you are on a Windows computer.

From what I've ready and what I've been told by our counterparts on the Windows side, the "Uninstall" function uses cached copies of items an installer moved/merged/deleted during the install.

This way when an uninstall is performed, all the files that were deleted/moved/merged/etc., can be moved back.

That's not what happens on a Mac. No matter what tool you use.

Not saying you can't remove anything, for example Composer DMG with indexing can remove what it installed, but is that really "Uninstalling"?

Not really. Oh well, it is what it is. I really wish Apple would provide a REAL uninstaller with the os.

--
https://donmontalvo.com

isterling_goaaa
New Contributor III

@Chris_Hafner – thanks for this. With the newer versions of JAMF Pro, I've been able to index and remove a .pkg file as well.

Have you had any experience with indexing a package after installation, and successfully removing said package from machines onto which the un-indexed version was installed? If it's the same package, only indexed later, it should have the same files in the same locations, yes?

Thanks in advance.

Chris_Hafner
Valued Contributor II

@isterling.goaaa You are quite correct! This is a feature that was added later and works on just about anything I've created in Composer lately. I've not tried anyone else's .pkgs. Also, I haven't tried indexing packages for removal after the fact but it should work just fine. Indexing a package doesn't change the .plkg itself. It simply creates an index for the JSS to facilitate a removal from. I doubt this works on flat packages, but I'm not sure.

Chris_Hafner
Valued Contributor II
  • I can't remember which version of the JSS this changed in, but it did change in the v9.x era/

bcbackes
Contributor III

Hello, I'm fairly new to Jamf and Macs in general. I'm trying to create an uninstaller for Palo Alto Traps. I received the source files from my Security department that contained the following: server.xml, Traps Uninstaller.app, Traps.pkg.

I dropped the Traps.pkg into Composer and created a script that @matin had provided in a different thread. I can get Traps to install, however, when I go to deploy a new version of Traps it doesn't remove the old version and install the new. It appears that nothing happens other than the pkg being downloaded to the tmp folder.

I suspect I need to have some sort of uninstaller run before the new version installs. Again, everything installs correctly when Traps isn't already loaded on the Mac. I'm thinking I need to create some sort of preinstall script that runs the "Traps Uninstall.app", however, I don't have any experience on whether that can be done or even how to do it.

I did index the pkg in JamfAdmin and created a policy to uninstall. When I go to test this, nothing happens. Traps isn't uninstalled. I even tried using JamfRemote to uninstall the package, again, nothing happens. I'm not sure where to turn now. I'm currently running Jamf Pro 10.7.1.

Any ideas you have are greatly appreciated.

tak10
Contributor II

@bcbackes You shouldn't need to uninstall the old version of traps to update. There is no "Update" package, you just need the install package, server.xml in the same directory during the installation. I was told by the JAMF trainer, (this was 2 years ago so not sure this is true) but it is more efficient to create an uninstall script vs indexing the install package and running the uninstall process. The uninstall script can simply just remove the .app file and other plist or application support files.

Here is what I did to create the installation and uninstall policy for Traps.

Install Policy

Create a package using composer that places the traps installation package as well as server.xml. into the /tmp/ directory. You can do this by placing the these files in the /tmp/ directory and dragging into the composer window. This package will drop the install package and server.xml into the /tmp/directory.

Next, create a script in JAMF pro. You should only need a one liner. This will run the actual Traps installation package using the server.xml, as long as the server.xml and traps.pkg is in the same directory during the installation.

#!/bin/sh
installer -pkg /tmp/Traps.pkg -target /

Uninstall Policy
You can simply uninstall traps by running the following command.

#!/bin/sh
/Library/Application Support/PaloAltoNetworks/Traps/uninstall.sh

Create this one liner script in JAMF Pro and added to your uninstall policy. You can run this to uninstall the old version if you need.

Extension Attribute
You can also create an Extension attribute to report back the Traps agent version.
It's not the prettiest way of getting the version number but it works for me.

#!/bin/bash
traps_version="/Library/Application Support/PaloAltoNetworks/Traps/bin/traps_agent.app/Contents/Info.plist"

if [ -f "$traps_version" ]
then
    result=`/bin/cat "$traps_version" | grep -A 1 CFBundleShortVersionString | grep "<string>" | sed -e 's/<[^>]*>//g' | awk '{print $1}'`
    echo "<result>$result</result>"
else
    echo "<result>0</result>"
fi

bcbackes
Contributor III

@tak10 Thank you very much for the info! I did try setting up the script in Jamf Pro under Computer Management/Scripts. Or, was I supposed to create a pkg in Composer using this script?
b73492844b404f958fb309ab8091798b

When I deployed it to two Macs they both failed with an exit code 75. 4cc4551fe7de4069ae6731e973c27e41

I apologize, I don't have any scripting knowledge, however, I'm an eager learner. I haven't done anything with your Extension Attribute example above since I have no knowledge of them or how they are used. I'll need to look them up at a later time. I'm more focused on getting Traps setup to be installed/uninstalled.

When you said I shouldn't need to remove Traps to upgrade to a newer version are you saying the installation can be placed on top of the other and it should install without any issues?

Thanks again for your help!

SheikSena
New Contributor

Hello All, I'm facing a problem with Package Uninstallation - Got a success message as the package uninstalled but the package not uninstalled on the mac machine. Please help me with this issue?

Logs:
Executing Policy FireFox-UnInstall
Getting package details from Uninstalling... Looking for Applications... Deleting files...
Uninstalled Firefox 72.0.2.pkg.
Running Recon...
Retrieving inventory preferences from
Locating package receipts...
Searching path: /System/Applications
Locating accounts...
Locating printers...
Gathering application usage information from the JamfDaemon...
Searching path: /Applications
Locating hardware information (macOS 11.1.0)...