Skip to main content
Question

Trying to delete User accounts with JAMF Schools Script


Forum|alt.badge.img+1

Trying to delete User accounts with JAMF Schools Script.

I had it not error before and it seemed to delete but the account would still be on the login screen. ~

 

#!/bin/bash

users=("Class1")

# Delete users and their home directories
for user in "${users[@]}"; do
# Check if the user exists
if dscl . -read /Users/$user &>/dev/null; then
# Delete the user account
sudo dscl . -delete /Users/$user

# Remove the user's home directory
sudo rm -rf /Users/$user

echo "Deleted User -> $user and their home directory"
else
echo "User $user does not exist"
fi
done

 

Im returning 

1:233: execution error: /Library/Application Support/ZuluDesk Scripting/com.zuludesk.scripting.08af6178-237d-11ef-8da8-024f99ac106f/com.zuludesk.scripting.08af6178-237d-11ef-8da8-024f99ac106f.command: line 2: 
: command not found
/Library/Application Support/ZuluDesk Scripting/com.zuludesk.scripting.08af6178-237d-11ef-8da8-024f99ac106f/com.zuludesk.scripting.08af6178-237d-11ef-8da8-024f99ac106f.command: line 4: 
: command not found
/Library/Application Support/ZuluDesk Scripting/com.zuludesk.scripting.08af6178-237d-11ef-8da8-024f99ac106f/com.zuludesk.scripting.08af6178-237d-11ef-8da8-024f99ac106f.command: line 6: syntax error near unexpected token `do
'
/Library/Application Support/ZuluDesk Scripting/com.zuludesk.scripting.08af6178-237d-11ef-8da8-024f99ac106f/com.zuludesk.scripting.08af6178-237d-11ef-8da8-024f99ac106f.command: line 6: `for user in "${users[@]}"; do
' (2 

 

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