Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Applehelpwriter 2016
- # This script will log out all other users on the mac
- # CAUTION: Any unsaved data in those user accounts will be lost
- # For more info see
- # http://applehelpwriter.com/2016/04/30/how-to-log-out-another-user-without-logging-in/
- set thisUser to do shell script "whoami"
- set usrList to paragraphs of (do shell script "ps caux -o args | grep loginwindow")
- repeat with i from 1 to number of items in usrList
- set this_item to item i of usrList
- set thatUser to word 1 of this_item
- if thisUser is not equal to thatUser then
- set theProcessNum to word 2 of this_item
- do shell script "kill -9 " & theProcessNum with administrator privileges
- end if
- end repeat
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement