Skip to main content
Question

Logout Hook script to delete AD mobile directories

  • October 3, 2016
  • 1 reply
  • 6 views

Forum|alt.badge.img+1

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

Forum|alt.badge.img+16
  • Valued Contributor
  • October 3, 2016

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