Skip to main content
Solved

Need help with System Pref General Setting

  • March 28, 2017
  • 11 replies
  • 27 views

Forum|alt.badge.img+11

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.

Best answer by gda

[~ 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

11 replies

mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • March 28, 2017

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.


Forum|alt.badge.img+13
  • Honored Contributor
  • March 28, 2017

@NealIV I use that line in my 1st boot setup script. You could use outset to run it for users at login


gda
Forum|alt.badge.img+8
  • Contributor
  • Answer
  • March 29, 2017

[~ 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


mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • March 29, 2017

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.


Forum|alt.badge.img+11
  • Author
  • Contributor
  • April 12, 2017

It wouldn't work when I tried to out it in a policy as a script. It did work locally via terminal.


mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • April 12, 2017

@NealIV You seem to have missed the whole "from root user" line above from @gda . The command as you have it right now will be affecting the preferences for the root account, not the logged in, or current user.


Forum|alt.badge.img+11
  • Author
  • Contributor
  • April 12, 2017

@mm2270 When I run the "From Root User" as a policy it give me this.


mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • April 12, 2017

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.


Forum|alt.badge.img+11
  • Author
  • Contributor
  • April 12, 2017

@mm2270 the 2nd script worked! Just had to log out then back in. Thanks!


seanhansell
Forum|alt.badge.img+15
  • Contributor
  • June 1, 2017

Can the Global Domain keys be managed by a configuration profile?


Forum|alt.badge.img+1
  • New Contributor
  • February 4, 2025

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