I'm currently trying to uninstall Cortex XDR from company devices, but I'm encountering an error that says "Uninstaller not found." The uninstaller is located in the folder '/Library/Application Support/PaloAltoNetworks/Traps/bin/'.
Do you have any recommendations or suggestions? Here is my script for the uninstallation:
I took that info and wrote a script based on the steps.
#!/bin/sh
# Cortex XDR Uninstaller with variable password.sh
#
# Created by Ed C. on 1/24/25.
#
#####################
# Pulling from the KBase here
# https://docs-cortex.paloaltonetworks.com/r/Cortex-XDR/8.6/Cortex-XDR-Agent-Administrator-Guide/Uninstall-the-Cortex-XDR-Agent-for-Mac
#####################
# Using the command here
# /Library/Application\\ Support/PaloAltoNetworks/Traps/bin/cortex_xdr_uninstaller_tool --help
# Usage:
# Get password from stdin: cortex_xdr_uninstaller_tool
# Get password from command line: cortex_xdr_uninstaller_tool <password>
# Will pass the password as a Jamf parameter for $4
#####################
#####################
# Begin work
#####################
XDR_Token=$4
/Library/Application\\ Support/PaloAltoNetworks/Traps/bin/cortex_xdr_uninstaller_tool $XDR_Token
# Check if the directory is empty and remove it if it is
if [ -d "/Library/Application Support/PaloAltoNetworks" ]; then
if [ -z "$(ls -A "/Library/Application Support/PaloAltoNetworks")" ]; then
echo "Directory /Library/Application Support/PaloAltoNetworks is empty. Removing it now..."
rmdir "/Library/Application Support/PaloAltoNetworks"
echo "Directory /Library/Application Support/PaloAltoNetworks has been removed."
exit 0
else
echo "Directory /Library/Application Support/PaloAltoNetworks is not empty. Exiting with error."
exit 1
fi
else
echo "Directory /Library/Application Support/PaloAltoNetworks does not exist."
exit 0
fi
exit 0
You could just composer your own uninstaller by packaging the binary to put it where it is supposed to be or some type of landing zone like /tmp. Then use your post install script to call the binary from the landing zone location. Make a check-in policy in Jamf and deploy.
I took that info and wrote a script based on the steps.
#!/bin/sh
# Cortex XDR Uninstaller with variable password.sh
#
# Created by Ed C. on 1/24/25.
#
#####################
# Pulling from the KBase here
# https://docs-cortex.paloaltonetworks.com/r/Cortex-XDR/8.6/Cortex-XDR-Agent-Administrator-Guide/Uninstall-the-Cortex-XDR-Agent-for-Mac
#####################
# Using the command here
# /Library/Application\\ Support/PaloAltoNetworks/Traps/bin/cortex_xdr_uninstaller_tool --help
# Usage:
# Get password from stdin: cortex_xdr_uninstaller_tool
# Get password from command line: cortex_xdr_uninstaller_tool <password>
# Will pass the password as a Jamf parameter for $4
#####################
#####################
# Begin work
#####################
XDR_Token=$4
/Library/Application\\ Support/PaloAltoNetworks/Traps/bin/cortex_xdr_uninstaller_tool $XDR_Token
# Check if the directory is empty and remove it if it is
if [ -d "/Library/Application Support/PaloAltoNetworks" ]; then
if [ -z "$(ls -A "/Library/Application Support/PaloAltoNetworks")" ]; then
echo "Directory /Library/Application Support/PaloAltoNetworks is empty. Removing it now..."
rmdir "/Library/Application Support/PaloAltoNetworks"
echo "Directory /Library/Application Support/PaloAltoNetworks has been removed."
exit 0
else
echo "Directory /Library/Application Support/PaloAltoNetworks is not empty. Exiting with error."
exit 1
fi
else
echo "Directory /Library/Application Support/PaloAltoNetworks does not exist."
exit 0
fi
exit 0