Remove Casper JSS Client Components

Description 
 To remove all Casper JAMF Software-related components from computers that have been managed by the JSS. 
 Ingredients 
 
 FW Central 
 (Other tools, features, and applications that will be needed) 
 
 Directions 
 
 Create a new empty Fileset (From the Fileset View : New Desktop Fileset > Empty : Type a Name > OK) 
 With it selected: Click the Scripts item in the button bar 
 Create a new activation script and name it. 
 Paste the script below and edit
 #!/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
 
 
 Associate as standard or scheduled