Dock items add and remove

tcandela
Valued Contributor II

I've noticed that if I create a policy to add or remove dock items, it only effects current user accounts.

I created a policy to remove a bunch of dock items (mail, contacts,itunes,app store,maps,ibooks etc...).

If a new user logs in, AFTER THE POLICY ALREADY RAN, they are given the default dock with all the items. is this how it is supposed to work ?

1 ACCEPTED SOLUTION

dferrara
Contributor II

The policy you created isn't going to change the User Template, which is why you're seeing the default dock on new users. What you could do is change your trigger to Once per user per computer, which should make the change for any user on that computer.

View solution in original post

29 REPLIES 29

dferrara
Contributor II

The policy you created isn't going to change the User Template, which is why you're seeing the default dock on new users. What you could do is change your trigger to Once per user per computer, which should make the change for any user on that computer.

tcandela
Valued Contributor II

i just change the execution frequency from

ONCE PER COMPUTER to ONCE PER USER PER COMPUTER

let me see now how this policy behaves.

Has anyone ever used ONCE PER USER PER COMPUTER ??

tcandela
Valued Contributor II

@dferrara wow, thanks for the response, you clarify what i was thinking.

I didn't see your response until i already made the change in the JSS and posted my comment.

does this also apply for policies that ADD to the DOCK ?

Look
Valued Contributor III

Has anyone actually had any success making the JAMF supplied Dock items work reliably?
I gave up some time ago and went with Dock Util, which once you get around how it works does a really great job.

dferrara
Contributor II

@tcandela No problem! Yes it should work for adding to the dock as well. If you need more flexibility than what the JSS offers, a lot of us are using dockutil. It requires more work, but once you have the package installed, you can make changes in Terminal and use Casper to run dock scripts instead.

mhasman
Valued Contributor

Adding to Dock works for me.

Remember it was not working last time I wanted to use it, tested it an hour ago with some new software distribution policy working on now, and was gladly surprised to find it working as well. Got new icon to the Dock. Seems to be fixed in 9.82

Thanks, JAMF!

tcandela
Valued Contributor II

What is the best TRIGGER to use when implementing ONCE PER USER PER COMPUTER?

I have my Dock policy set at Recurring check in. Should it be changed to 'Login' as the trigger ?

tcandela
Valued Contributor II

i'm on 9.81,as per the policy logs, looks to be working for me when removing/adding dock items when implementing ONCE PER USER PER COMPUTER at LOGOUT.

dferrara
Contributor II

@tcandela I haven't tried Logout, that's good to know. I usually use the Login trigger.

tcandela
Valued Contributor II

I set my DOCK policy to remove items at LOGIN, looks to be acting weird, some of the dock items I have setup to be removed from the Dock still show up (MAPS,PHOTOS,IBOOKS), and a couple i do not want removed are gone (NOTES,SYSTEMPREFERENCES).

It might be that 9.82 fixed this possible issue that @mhasman mentioned above.

tcandela
Valued Contributor II

@ Logout, works as expected. @ login does not work correctly,

i'll check out this dockutil

dferrara
Contributor II

@tcandela It has worked wonders for me, I have it in production now. I couldn't find a single guide on how to use it and set it up, so be prepared for some research. Also, if you are deploying with El Capitan, some of that space is protected now. I have mine installed here:

/usr/local/bin/dockutil

After that, it's just a matter of getting your commands to the dockutil binary right.

Sachin_Parmar
Contributor

I would also have a look at DockUtil it works great and can do everything you want it to check the dockutil github code here, place the python script on the users machine and then write your script in Management Settings to do what you want it to do, run it at login, you should be all good to go.

I do mine at imaging and have it as a ongoing self service script if user's want to get back to their default as such, obviously you can adapt and change it around for your needs:

#!/bin/bash
/path/to/dockutil.py --add /Applications/Self Service.app --position 2 --allhomes
/path/to/dockutil.py --move 'App Store' --position 3 --allhomes
/path/to/dockutil.py --add /Applications/Google Chrome.app --position 4 --allhomes
/path/to/dockutil.py --remove 'Safari' --allhomes
/path/to/dockutil.py --remove 'Mail' --allhomes
/path/to/dockutil.py --remove 'Contacts' --allhomes
/path/to/dockutil.py --remove 'Calendar' --allhomes
/path/to/dockutil.py --remove 'Notes' --allhomes
/path/to/dockutil.py --remove 'Reminders' --allhomes
/path/to/dockutil.py --remove 'Photos' --allhomes
/path/to/dockutil.py --remove 'Messages' --allhomes
/path/to/dockutil.py --remove 'FaceTime' --allhomes
/path/to/dockutil.py --remove 'iTunes' --allhomes
/path/to/dockutil.py --remove 'iBooks' --allhomes
/path/to/dockutil.py --remove 'Maps' --allhomes

tcandela
Valued Contributor II

I'd rather have JSS dock item policy work @ login, but it acts weird, items i want removed stay, items i want to stay are gone. @ logout works though.

I took a brief look at dockutil on github, so I have to just place a file (python script) on each enrolled mac (/usr/local/bin/dockutil), and then i can issue commands to manipulate the dock ?

dferrara
Contributor II

@tcandela Yes, exactly. There's also a Feature Request to integrate dockutil into Casper here:

https://jamfnation.jamfsoftware.com/featureRequest.html?id=1982

Sachin_Parmar
Contributor

@tcandela yes exactly. The dockutil script has a function where it adds it to all the user's home folders. you could set a policy that runs it on log in.

@dferrara The Feature request is a must!

tcandela
Valued Contributor II

@Sachin_Parmar just so i understand correctly your lost post;

are you saying i create a script to do what i want to the dock (parts of your script below), create a policy to run the script , and that function --allhomes -- will set that dock for all current and future users home folders ?

!/bin/bash

/path/to/dockutil.py --add /Applications/Self Service.app --position 2 --allhomes
/path/to/dockutil.py --move 'App Store' --position 3 --allhomes
/path/to/dockutil.py --add /Applications/Google Chrome.app --position 4 --allhomes
/path/to/dockutil.py --remove 'Safari' --allhomes
/path/to/dockutil.py --remove 'Mail' --allhomes
/path/to/dockutil.py --remove 'Contacts' --allhomes
/path/to/dockutil.py --remove 'Calendar' --allhomes
/path/to/dockutil.py --remove 'Notes' --allhomes

Nix4Life
Valued Contributor

dock-master also works well if you want to go the profile route

Sachin_Parmar
Contributor

@tcandela Yes that's correct, it adds it to all current user's of the Mac not future users but you can make a casper policy that effectively run's the dock script as the user either as an ongoing script or "Once per user per computer" execution frequency at Login for future users.

Here's the extract from the --allhomes flag from the dockutil code attempts to locate all home directories and perform the operation on each of them Source

tcandela
Valued Contributor II

@mhasman what trigger and frequency are you using ? are you both adding/removing dock items ?

mhasman
Valued Contributor

@tcandela Trigger? I do not use DockUtil but settings in policy on JSS:
3c4325348ee04cab9b943d414c3b8400

tcandela
Valued Contributor II

@mhasman yeah I know your using the JSS policy for your dock items. I just upgraded my test machine to 9.82, so I'll see if @ login trigger behaves correctly unlike in 9.81

what trigger (logout, login ?? etc.. ) and frequency (once per computer, once per user per computer.. ?) are you using for the policy ? are you both adding/removing dock items ?

rblaas
Contributor II

Has anyone got dockutil working correctly on Yosemite?

We are not fully upgraded to El Capitan yet and I have tried to add/remove documents from the dock without success. Loggin states items have been added/removed but the result is not correctly visible in the dock. Even after restart/logout/login.

I did run the script in my test while user was logged in (and the script restarted the dock)

Will try to run at logout to see if this gives better results.

With a policy on the JSS as @mhasman is using is also not giving me the results I want..

dferrara
Contributor II

@rblaas We are on El Cap but have you tried adding the sleep 30 command before your script runs? Without that command my script usually fails. Also here's an example line:

sudo -u $3 /usr/local/bin/dockutil --remove 'Numbers' --no-restart

Each line has --no-restart except for the last line.

rblaas
Contributor II

@dferrara No I have not and will definitely try that.

thanks for the tip

tcandela
Valued Contributor II

@dferrara @rblaas to get the python script on your client macs, did you create a pkg to place the file on each computer in one of the $PATH locations ?

I'm still testing the JSS policy using DOCK payload with now 9.82 instead of 9.81.

9.81 policy works good on LOGOUT but I want it to work on LOGIN. So if 9.82 does not work on LOGIN, then i'll try dockutil

rblaas
Contributor II

@tcandela I distribute the python script via pkg and install in in /usr/local/bin.

tcandela
Valued Contributor II

with El Capitan, looks like Apple has also defined some exceptions to SIP’s protection in the rootless.conf file, and one of those exemptions is /usr/local

tcandela
Valued Contributor II

is anyone having problems using dockutil with El Capitan ?