Need help with System Pref General Setting

NealIV
Contributor

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.4264c949e8554285a7b1d67f3e1d03e2

2 ACCEPTED SOLUTIONS

gda
Contributor

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

View solution in original post

mm2270
Legendary Contributor III

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.

View solution in original post

10 REPLIES 10

mm2270
Legendary Contributor III

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.

Nix4Life
Valued Contributor

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

gda
Contributor

[~ 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
Legendary Contributor III

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.

NealIV
Contributor

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

mm2270
Legendary Contributor III

@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.

NealIV
Contributor

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

mm2270
Legendary Contributor III

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.

NealIV
Contributor

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

seanhansell
Contributor

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

- Sean