Locking the Dock

lee_smith
Contributor

Hey Guys!

I am trying to lock the docks in our Elementary School Lab. I have the following command:

"defaults write com.apple.dock contents-immutable -bool true"

I have found though, I have to run it as the user. The good news is for the Elementary Lab we have a Generic Account.

Is there away in Casper I can run the command as the generic user?

Thank you all in advance.

1 REPLY 1

mm2270
Legendary Contributor III

Whenever a defaults command is run that doesn't specify the exact plist path as you have above, it will only affect the current logged in user account. So defaults write com.apple.dock is actually doing something like
defaults write ~/Library/Preferences/com.apple.dock.plist

To fix this, you can either:
1- Use a Configuration Profile to set the setting, or even set up the Dock and make it immutable at one time. See here for an example.
2- Change the command to capture the logged in user and run the defaults command against their Dock.plist
3- Have the policy run as a login trigger, but substitute the logged in user with $3 in the script.

There are probably other options as well as the ones above.