Ask to keep changes when closing documents toggle on

macdsl
New Contributor III

I just need a simple setting change in Casper..
I'm trying to toggle: System Prefs--General--Ask to keep changes when closing documents
I need to turn it checked for everyone at the agency.
Can I do that in Configuration Profiles?
If not, does anyone know a Terminal Command I can send out as a script?

Thanks!

4 REPLIES 4

roiegat
Contributor III

So I did a quick composer test and told it to capture new and modified. The snap showed the following file was changed:
/users/XXXX/Library/Preferences.GlobalPreferences.plist

Where XXXX is the username.

Opening that file I think the setting you want to modify is called NSCloserAlwasyConfirmsChanges and set it to yes.

So putting all this together you can do it in command line via:

defaults write /users/XXXX/Library/Preferences.GlobalPreferences.plist NSCloserAlwasyConfirmsChanges -bool true

I haven't tested it, but give it a shot...should work ok.

rskolden
New Contributor III

@roiegat you are correct, this is a piece of our "default settings"-script:

echo "Ask to save changes when closing application"
for USER_TEMPLATE in "/System/Library/User Template"/* do defaults write "${USER_TEMPLATE}"/Library/Preferences/.GlobalPreferences NSCloseAlwaysConfirmsChanges -bool true
done

macdsl
New Contributor III

@roiegat That was a great idea utilizing Composer, and i should have thought of it, Thanks! I tried the defaults write /-- suggestion, and if i run it on my machine using my name it makes no changes, even tried restarting the finder..
even tried changing it to -bool false and no changes .

@rskolden I think that only works for a User Template? And it will set it properly for new users created on the machine? Unfortunately i need to change about 90 existing users; so i'm not sure how to get that to translate? I appreciate the help, but Scripting/Terminal is where i'm really unskilled.

Because this looks like a User-specific change instead of something i can change system-wide, i even tried using ARD to push out: defaults write Preferences.GlobalPreferences.plist NSCloserAlwasyConfirmsChanges -bool true at the current user instead of root, and that made no change..

I think i'm close though.

But I do thank you for your assistance.

rskolden
New Contributor III

@macdsl Sorry, i may have been a bit unclear,

in your case i think i had gone with the following script:

for USER_TEMPLATE in "/System/Library/User Template"/*
do defaults write "${USER_TEMPLATE}"/Library/Preferences/.GlobalPreferences NSCloseAlwaysConfirmsChanges -bool true
done

for USERS in /Users/*
do defaults write "${USERS}"/Library/Preferences/.GlobalPreferences NSCloseAlwaysConfirmsChanges -bool true
done

test it before deploying but the USER_TEMPLATE part is for all new users and the USERS part is for all the existing users on the client.
This way you dont have to specify the usernames, it will just take all the existing and upcoming users and set the setting.

Since this is set per user I personally don't have the skills to make an Extension Attribute check for the setting, however, you can do a quick-n-dirty approach where you create a "dummy-file", which you easily can do a Extension Attribute for and see what computers have gotten the policy.

This will also allow you to deploy it with "ongoing" and a smart group based on the Extension Attribute, to make sure that all your clients get the setting.