I would be interested to know this as well.
I believe this should do the trick
defaults write NSGlobalDomain NSQuitAlwaysKeepsWindows -bool false
Also, I haven't tested the older commands in the newer OS, but a combo of these may still be accurate as well..
defaults write com.apple.loginwindow TALLogoutSavesState -bool false
defaults write com.apple.loginwindow LoginwindowLaunchesRelaunchApps -bool false
defaults write com.apple.loginwindow TALLogoutSavesState -bool false was it - thank you!
actually - weird- I ran it via my computer + terminal - works fine. I put it in execute command / files and processes via a policy - nothing. strange
@jan.rosenfeld
that's a user setting and Jamf commands run as root. You probably need to do something like this:
EDIT: Set this up in a jamf policy and it worked on my machine.
#!/bin/bash
loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`
loggedInUID=$(id -u "$loggedInUser")
#Disable Reopen Windows When Logging Back In
/bin/launchctl asuser "$loggedinUID" sudo -iu "$loggedInUser" defaults write com.apple.loginwindow TALLogoutSavesState -bool false
exit 0
@strayer I ended up running the following through Outset:
#!/bin/sh
user=`ls -la /dev/console | cut -d " " -f 4`
sudo -u $user defaults write com.apple.loginwindow TALLogoutSavesState -bool false
and all works perfectly!
@strayer I ended up running the following through Outset:
#!/bin/sh
user=`ls -la /dev/console | cut -d " " -f 4`
sudo -u $user defaults write com.apple.loginwindow TALLogoutSavesState -bool false
and all works perfectly!
Hi Jan
Can you explain how you used Outset?
@jan.rosenfeld
that's a user setting and Jamf commands run as root. You probably need to do something like this:
EDIT: Set this up in a jamf policy and it worked on my machine.
#!/bin/bash
loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`
loggedInUID=$(id -u "$loggedInUser")
#Disable Reopen Windows When Logging Back In
/bin/launchctl asuser "$loggedinUID" sudo -iu "$loggedInUser" defaults write com.apple.loginwindow TALLogoutSavesState -bool false
exit 0
Hi Adam
Did you run this policy at startup or login?
also how did you test it locally?(not through jamf)
Hi Adam
Did you run this policy at startup or login?
also how did you test it locally?(not through jamf)
I run this policy once per computer during the initial setup. If the user wants to change it back I don't really care that much.
To test it locally put that text into a script file that ends in .sh and then in terminal run
sudo sh /path/to/script.sh
It runs differently when running from Jamf though because scripts run as root and not as the logged in user. That's why you need the get logged in user and the sudo -iu $loggedInUser bit.
@jan.rosenfeld
that's a user setting and Jamf commands run as root. You probably need to do something like this:
EDIT: Set this up in a jamf policy and it worked on my machine.
#!/bin/bash
loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`
loggedInUID=$(id -u "$loggedInUser")
#Disable Reopen Windows When Logging Back In
/bin/launchctl asuser "$loggedinUID" sudo -iu "$loggedInUser" defaults write com.apple.loginwindow TALLogoutSavesState -bool false
exit 0
Hey, Adam. Been wanting to look at this for a while. I run this script and it runs successfully. But nothing changes. Do I need to plug the acct name of the logged in user as a variable? Thanks!