Posted on 03-28-2017 01:26 PM
I am looking to change all of my users System preferences --> General --> set 'Show scroll bars' to 'Always'. I didnt see it in "managed Preferences" so I am wondering how to set this in jamf for my users.
Solved! Go to Solution.
Posted on 03-29-2017 01:54 AM
[~ NealIV] To write into users .GlobalPreferences.plist use
defaults write -globalDomain AppleShowScrollBars -string "What ever you want to set"
From root user:
sudo -u username defaults write -globalDomain AppleShowScrollBars -string "What ever you want to set"
@mm2270 Unfortunately
defaults write -currentHost ...
will write in to ByHost prefs, but not in .GlobalPreferences.plist
Posted on 04-12-2017 12:01 PM
Because "username" is not a real name of the logged in user. Your script needs to first get the logged in username in a variable, and then use that in the defaults command, like this
#!/bin/sh
loggedInUser=$(stat -f%Su /dev/console)
sudo -u $loggedInUser defaults write -globalDomain AppleShowScrollBars -string Always
YMMV with that though. In my experience trying to do sudo -u someuser only works sporadically. There are some more reliable, but more involved methods if that doesn't work for you.
You could also just direct the defaults command right at the user's .GlobalPreferences.plist file instead.
#!/bin/sh
loggedInUser=$(stat -f%Su /dev/console)
defaults write /Users/$loggedInUser/Library/Preferences/.GlobalPreferences.plist AppleShowScrollBars Always
chown $loggedInUser /Users/$loggedInUser/Library/Preferences/.GlobalPreferences.plist
None of the above are tested. I wrote them in directly in the post window, so make sure to test them locally first.
Posted on 03-28-2017 02:02 PM
Hi. That gets stored in each user's ~/Library/.GlobalPreferences.plist
, in a setting called AppleShowScrollBars
set to a string of Always
Other options are "Automatic" and "WhenScrolling"
I don't know if that's a built in Configuration Profile option. It doesn't look like it. You can probably create that from a custom plist uploaded to make a Custom Payload for a Profile, but I haven't tried that to see.
Barring that, you could, I suppose, script it. Something like:
/usr/bin/defaults write /Users/$username/Library/.GlobalPreferences.plist AppleShowScrollBars Always
or/usr/bin/defaults write -currentHost AppleShowScrollBars
For the latter, it would need to be run as the current user, not from root or your service account.
Problem is, I'm not sure if injecting it that way will make it take effect right away. I suspect not until after the Finder is restarted maybe.
Posted on 03-28-2017 04:23 PM
@NealIV I use that line in my 1st boot setup script. You could use outset to run it for users at login
Posted on 03-29-2017 01:54 AM
[~ NealIV] To write into users .GlobalPreferences.plist use
defaults write -globalDomain AppleShowScrollBars -string "What ever you want to set"
From root user:
sudo -u username defaults write -globalDomain AppleShowScrollBars -string "What ever you want to set"
@mm2270 Unfortunately
defaults write -currentHost ...
will write in to ByHost prefs, but not in .GlobalPreferences.plist
Posted on 03-29-2017 08:52 AM
Good grief! :( You're right @gda. Thanks for pointing out my error. Not only that, but even if it was right, my command above was incomplete to boot as it was missing the Always string.
Impending middle age. That's my excuse.
Posted on 04-12-2017 07:17 AM
It wouldn't work when I tried to out it in a policy as a script. It did work locally via terminal.
Posted on 04-12-2017 08:05 AM
Posted on 04-12-2017 11:15 AM
@mm2270 When I run the "From Root User" as a policy it give me this.
Posted on 04-12-2017 12:01 PM
Because "username" is not a real name of the logged in user. Your script needs to first get the logged in username in a variable, and then use that in the defaults command, like this
#!/bin/sh
loggedInUser=$(stat -f%Su /dev/console)
sudo -u $loggedInUser defaults write -globalDomain AppleShowScrollBars -string Always
YMMV with that though. In my experience trying to do sudo -u someuser only works sporadically. There are some more reliable, but more involved methods if that doesn't work for you.
You could also just direct the defaults command right at the user's .GlobalPreferences.plist file instead.
#!/bin/sh
loggedInUser=$(stat -f%Su /dev/console)
defaults write /Users/$loggedInUser/Library/Preferences/.GlobalPreferences.plist AppleShowScrollBars Always
chown $loggedInUser /Users/$loggedInUser/Library/Preferences/.GlobalPreferences.plist
None of the above are tested. I wrote them in directly in the post window, so make sure to test them locally first.
Posted on 04-12-2017 12:46 PM
@mm2270 the 2nd script worked! Just had to log out then back in. Thanks!
Posted on 06-01-2017 07:43 AM
Can the Global Domain keys be managed by a configuration profile?
Tuesday
Just to let everyone know. This script worked that @mm2270 mm270 recommended.
#!/bin/sh
loggedInUser=$(stat -f%Su /dev/console)
defaults write /Users/$loggedInUser/Library/Preferences/.GlobalPreferences.plist AppleShowScrollBars Always
chown $loggedInUser /Users/$loggedInUser/Library/Preferences/.GlobalPreferences.plist