Hey all, I am stumped and hoping for some guidance.
I am trying to set Finder Preferences to show Hard Disks, External Disks, External Media, and Connected Servers. I have the script below deployed via policy and it works like a charm for everything but connected servers. I have been banging my head on my desk all day. I know the script runs as root and I have to get it to run as the logged in user AND pointed at the correct .plist of the logged in user and it seems like it is considering 3 of the 4 booleans flip...
Before anyone chimes in about how I should do this with a configuration profile,
- We just want it set once per user per computer and the user can change it after that if they want.
- I am dealing with a JSS that has database corruption and I cannot push new configuration profiles anyway. (We are migrating everything to a new healthy instance soon.)
#!/bin/bash
#First, get logged in user and set as a variable $user
user=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`
/usr/bin/defaults write /Users/"$user"/Library/Preferences/com.apple.finder ShowExternalHardDrivesOnDesktop -bool true;
/usr/bin/defaults write /Users/"$user"/Library/Preferences/com.apple.finder ShowHardDrivesOnDesktop -bool true;
/usr/bin/defaults write /Users/"$user"/Library/Preferences/com.apple.finder ShowMountedServersOnDesktop -bool true;
/usr/bin/defaults write /Users/"$user"/Library/Preferences/com.apple.finder ShowRemovableMediaOnDesktop -bool true;
killall Finder
exit 0
When I run the script locally, it works like a charm. When I run the script via policy, everything is set right but connected servers. Please point out whatever ridiculous mistake I have made and thank you all for being an awesome community resource!
