fleet/docs/solutions/macos/scripts/remove-jamf.sh
Steven Palmesano 6a3578ce46
Update Jamf API endpoints (#39146)
Discussed at
https://macadmins.slack.com/archives/C0214NELAE7/p1769719765777279
- The endpoints for marking a device as unmanaged and sending an
unmanage command were deprecated and no longer work. The endpoint for
looking up a device by serial number was also deprecated, so I've
proactively updated it.
- The whole story is now refactored and simplified.
- Also fixed a link in the `tines` README.
2026-02-06 13:58:40 -06:00

37 lines
926 B
Bash

#!/bin/bash
# This script runs one last recon and then removes the Jamf framework.
# Must be run as root. Deploy with Fleet, NOT Jamf Pro.
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root." >&2
exit 1
fi
jamf_binary=$(command -v jamf)
if [ -z "$jamf_binary" ]; then
for path in "/usr/local/bin/jamf" "/usr/local/jamf/bin/jamf" "/usr/sbin/jamf"; do
if [ -x "$path" ]; then
jamf_binary="$path"
break
fi
done
fi
if [ -z "$jamf_binary" ]; then
echo "Jamf binary not found. Exiting." >&2
exit 1
fi
echo "Jamf binary found at: $jamf_binary"
echo "Running final inventory update..."
$jamf_binary recon || echo "Warning: recon command failed (continuing anyway)"
echo "Removing Jamf framework..."
if $jamf_binary removeFramework; then
echo "Jamf removal successful!"
else
echo "Error: removeFramework command failed." >&2
exit 1
fi