This could be accomplished through capturing the username, through this or a similar method:
currentuser=`stat -f "%Su" /dev/console`
And then using a series of default write commands to appropriate preference domains and keys that you'd like to set.
defaults write /Users/$currentuser/<pathtopreferencedomain> <key>
Some of these settings may also be possible to set via a configuration profile that would apply to everyone. That said with apple's focus on privacy and the fact that a lot of these settings are personal preference, seems like a lot of work for minimal gain, could easily turn into IT is setting MY preferences rage. Just because you can, doesn't mean you should, time for new bosses
This could be accomplished through capturing the username, through this or a similar method:
currentuser=`stat -f "%Su" /dev/console`
And then using a series of default write commands to appropriate preference domains and keys that you'd like to set.
defaults write /Users/$currentuser/<pathtopreferencedomain> <key>
Some of these settings may also be possible to set via a configuration profile that would apply to everyone. That said with apple's focus on privacy and the fact that a lot of these settings are personal preference, seems like a lot of work for minimal gain, could easily turn into IT is setting MY preferences rage. Just because you can, doesn't mean you should, time for new bosses
I don't disagree about the new bosses, but while they are the ones signing my checks, I have to implement as much of their vision as possible, even when I disagree with it.
Here is what I have. Some of them aren't essential to our org so I don't have the scripts. We don't use all of them, so you'll have test it.
Warn before emptying trash is on by default I think.
#!/bin/sh
currentUser=$(ls -l /dev/console | awk '{print $3}')
# Set Scroll Bar To Always Showing
defaults write -g AppleShowScrollBars -string Always
# Show Hard Drive and Connected Servers on Desktop
su "$currentUser" -c "defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true;"
su "$currentUser" -c "defaults write com.apple.finder ShowMountedServersOnDesktop -bool true;"
# Toggle Dark/Light Mode
osascript -e \\
'tell application "System Events" to tell appearance preferences to set dark mode to not dark mode'
# Show All Filename Extensions
sudo -u $currentUser /usr/bin/defaults write /Users/$currentUser/Library/Preferences/.GlobalPreferences.plist AppleShowAllExtensions -bool true
sleep 2
killall Finder