Hi All,
I was utilizing the logout script featured in this discussion (https://www.jamf.com/jamf-nation/discussions/9902/forcing-logout-to-kick-off-filevault2) for enabling FileVault2.
## Get the logged in user's name
loggedInUser=$( ls -l /dev/console | awk '{print $3}' )
## Get the PID of the logged in user
loggedInPID=$( ps -axj | awk "/^$loggedInUser/ && /Dock.app/ {print $2;exit}" )
## Use the above to run Applescript command to logout using keystroke commands
/bin/launchctl bsexec "${loggedInPID}" sudo -iu "${loggedInUser}" "/usr/bin/osascript -e 'tell application "System Events" to keystroke "q" using {command down, option down, shift down}'"
I am noticing that this script is now unsuccessful in High Sierra with the following error:
Script exit code: 127 Script result: -bash: /usr/bin/osascript -e 'tell application "System Events" to keystroke "q" using {command down, option down, shift down}': No such file or directory Error running script: return code was 127.
Running each line individually from the shell is successful. The error is only present when packaging as a script. I've confirmed that /usr/bin/osascript is present for these users.
Can anyone think of any changes in High Sierra that may prevent this from working? OR maybe a more elegant way to accomplish a logout in High Sierra?
Thanks!
