reset dock to default

tcandela
Valued Contributor II

I'm trying to reset the dock to default via Self Service policy using the following execute command in files and processes

defaults delete com.apple.dock; killall Dock

it does nothing to the users dock that ran the self service policy!!!  itjust makes the dock briefly disappear and then re-appear (refreshing).

anyone have a policy that can re-create the default dock for the user that executes the policy via Self Service?

7 REPLIES 7

AVmcclint
Honored Contributor

Try adding a period to the end of the domain like this:  com.apple.dock.  See if that helps.  I also like to put a space at the end of my first command, then the semicolon, then another space. I do that just to make sure I'm explicit with my terms.  So I'd do it as defaults delete com.apple.dock. ; killall Dock 

mm2270
Legendary Contributor III

@tcandela if you’re running that exact defaults command then the only plist you’re deleting is the one for the root account. To do this effectively you need to direct the command to the logged in users Dock plist. So something like

defaults delete /Users/$loggedInUser/Library/Preferences/com.apple.dock.plist

...should delete the correct plist.

tcandela
Valued Contributor II

@mm2270  so do i just put in the command that you specified and nothing else? no ; Killall Dock

tcandela
Valued Contributor II

@AVmcclint @mm2270 I just want the current logged in users dock to be set back to the default dock. The user will go into self service and execute the policy. 

I'm going to try the command that @mm2270  posted wich is below, but do I need to add the ' ; Killall Dock' to the end of it?  

defaults delete /Users/$loggedInUser/Library/Preferences/com.apple.dock.plist

 

mainelysteve
Valued Contributor II

Yes you need to also issue a killall Dock otherwise the plist won't be regenerated. 

tcandela
Valued Contributor II

@mm2270  hi, the command to reset the logged in users dock does not work. Here are screenshots of the policy and the log entry for the computer that the policy ran from (self service policy). Users dock remains the same.

Screen Shot 2021-10-17 at 11.37.24 AM.pngScreen Shot 2021-10-17 at 11.36.59 AM.png

 

mainelysteve
Valued Contributor II

Try changing your variable to say $3 for instance. Unless I'm missing something but I believe $loggedinuser would require you run this in a script to capture that logged in user variable.