Hi All,
I currently use a script on logout in my labs that deletes the user's account. It keeps some local admin accounts but deletes the rest.
All works great in my Sierra and High Sierra environments. However in my testing with Mojave it keeps the last user when I login in with another. Then if I was to log out it keeps that last one but deletes the previous one. Hope that makes sense.
Login with USER A
Logout USER A
Login with USER B
If I look in the users folder, USER A is still there
Logout USER B
Login with USER C
If I look in the users folder, USER A is gone but USER B is still there.
Here is the script I am using. I actually got this form another user on the forum and thank you for that.
for dir in /Users/* do if [ ! "$dir" = "/Users/admin" ] && [ ! "$dir" = "/Users/viscom" ] && [ ! "$dir" = "/Users/root" ] && [ ! "$dir" = "/Users/main" ] && [ ! "$dir" = "/Users/Shared" ] ; then echo ${dir} rm -R $dir dscl . -delete $dir fi done
exit 0
Any suggestions would be greatly appreciated.