Remove Jamf Pro (Casper JSS) Client Components

What this Fileset does
This macOS Fileset runs Jamf Pro's local 
jamf removeFramework command to remove Jamf management components from a computer previously managed by Jamf Pro or Casper JSS. Confirm the Mac is ready to leave Jamf before deployment; removing the framework can end Jamf policy, inventory, and remote-management functions.
Requirements
FileWave Central access to create and deploy a macOS Fileset
A target Mac on which the Jamf binary is still installed and executable
A pilot device and an approved Jamf offboarding plan
Create the Fileset
In FileWave Central, open Filesets and select New Desktop Fileset > Empty.
Name the Fileset, select it, and open Scripts.
Create an Activation Script.
Paste the script below without changing the Jamf command unless your Jamf documentation requires a different supported removal method.
#!/usr/bin/env zsh
# This will remove JAMF from macOS
# Function to identify the location of the jamf binary
CheckBinary() {
    # Identify location of jamf binary using modern command substitution
    jamf_binary=$(which jamf)
    # Evaluate conditions to identify the correct binary path
    if [[ -z "$jamf_binary" ]] && [[ -e "/usr/sbin/jamf" ]] && [[ ! -e "/usr/local/bin/jamf" ]]; then
        jamf_binary="/usr/sbin/jamf"
    elif [[ -z "$jamf_binary" ]] && [[ ! -e "/usr/sbin/jamf" ]] && [[ -e "/usr/local/bin/jamf" ]]; then
        jamf_binary="/usr/local/bin/jamf"
    elif [[ -z "$jamf_binary" ]] && [[ -e "/usr/sbin/jamf" ]] && [[ -e "/usr/local/bin/jamf" ]]; then
        jamf_binary="/usr/local/bin/jamf"
    fi
    # Error handling for missing jamf binary
    if [[ -z "$jamf_binary" ]] || [[ ! -x "$jamf_binary" ]]; then
        echo "Error: jamf binary not found or not executable."
        exit 1
    fi
}
# Function to remove the JAMF framework
RemoveJamf() {
    "$jamf_binary" removeFramework || {
        echo "Error: Failed to remove JAMF framework."
        exit 2
    }
}
# Main script execution
CheckBinary
RemoveJamf
# Exit with a success status
exit 0
Deploy the Fileset to a pilot Mac first, verify that Jamf management is removed and FileWave remains healthy, then expand the deployment as a standard or scheduled association.