logout all other users

Apr 30th, 2016
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Applehelpwriter 2016
  2. # This script will log out all other users on the mac
  3. # CAUTION: Any unsaved data in those user accounts will be lost
  5. # For more info see
  6. #
  8. set thisUser to do shell script "whoami"
  9. set usrList to paragraphs of (do shell script "ps caux -o args | grep loginwindow")
  11. repeat with i from 1 to number of items in usrList
  12.     set this_item to item i of usrList
  13.     set thatUser to word 1 of this_item
  14.     if thisUser is not equal to thatUser then
  15.         set theProcessNum to word 2 of this_item
  16.         do shell script "kill -9 " & theProcessNum with administrator privileges
  17.     end if
  18. end repeat
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add to your ad blocker whitelist or disable your adblocking software.