Skip to main content
Question

macOS script (deleting users) in Jamf School resulting in error


EdwardB
Forum|alt.badge.img+4

Hi,

 

I try to delete users from a Mac with a script in Jamf School. The script is correct and works perfectly fine in Jamf Pro.

In Jamf School it results in an error:

<main> delete status: eDSPermissionError
<dscl_cmd> DS Error: -14120 (eDSPermissionError) (1)

Has anyone an idea to solve this issue?

 

This is the script:

#!/bin/bash
 
users=$( dscl . ls /Users | grep -v '_' | grep -v 'root' | grep -v 'daemon' | grep -v 'nobody' | grep -v 'localadmin' | grep -v 'BEHEER' | grep -v 'Guest' )
 
echo "Removing user accounts."
for a in ${users}; do
    # delete user
    /usr/bin/dscl . delete /Users/"$a" || { echo "Could not remove user $a"; exit 1; }
 
    # delete home folder
    /bin/rm -rf /Users/"$a" || { echo "Could not remove home directory of $a"; exit 2; }
    echo "Executed for: $a"
done
 
echo "Users accounts removed!"
exit 0

 

0 replies

Be the first to reply!

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings