Logout Hook script to delete AD mobile directories

thegreat718
New Contributor

Can anybody point me to a simple logout hook that will delete all AD mobile users when they logoff? I would like to keep an admin user, Shared folder, and a local user to run Unreal Engine and Unity. I need to keep the three folders named "tsc", "Shared", and "epic", while deleting the AD mobile users. The Macs are in a small lab environment running in an ADS environment.

1 REPLY 1

bvrooman
Valued Contributor

We delete a particular category of non-user accounts on logout, so that machines don't clog up with accounts that users won't really understand. We scope a logout policy that runs this script:

if [[ $3 == admin-* ]]
then
    jamf deleteAccount -username $3
    echo "Deleted $3's mobile account."
else
    echo "$3 was not deleted."
fi