Removing Dock Icons With Same Name


So we are planning on rolling out Office 2016 to our campus soon and we are going to be giving users the option to install 2016 alongside 2011 for the time being. Once they are happy with 2016, they can run the uninstaller we have in Self Service.

The issue I am having is that the only way for a dock icon to be removed using the JSS is if the dock icon name matches the application name. This is a problem because the JSS doesn't let you add duplicate dock icons.

For example, I need to have

Microsoft Word - file://localhost/Applications/Microsoft%20Office%202011/


Microsoft Word   - file://localhost/Applications/

But this is not possible in the JSS. So I gave dockutil a try and the only way to remove individual icons is to removing using the generic name. If I change the name from "Microsoft Word" to "Microsoft Word 2011" it no longer removes when I use the remove dock icon option in the JSS policy.

dockutil --remove 'Microsoft Word'

Which will remove both 2011 and 2016.

If a user has all the icons from 2011 and 2016 in their dock, and they run the uninstaller script, I want the 2011 icons removed, not the 2016.

Any suggestions?


Valued Contributor II

@dhanes if the end user needs to do a removal of Office 2011, couldn't you remove all the shortcuts to both versions of Office with dockutil and add back the shortcuts for just Office 2016? It's not exactly what you're looking to do but would have the same net effect.

Contributor II

I was able to do this using the JSS built in tools. Fortuantely the install paths for Office 2011 and 2016 are different. Office 2011 is /Applications/MS Office 2011/Microsoft Office 2016 is /Applications/Microsoft

I made a policy that removes the Office 2011 icon and adds the Office 2016 icon. Here's a screenshot of my policy, you can ignore the other items in there and just look at the dock stuff:

I thought about writing a script for the dockutil app that said if Outlook is on the dock then remove it and replace with the new Outlook icon. I didn't go that route though.


I would probably go with @mpermann’s idea, myself. Remove all of them and add back just the ones needed.

If you want to directly replace one item with another, like Outlook 2011 with Outlook 2016, you can do that already with dockutil:

dockutil --add /Applications/Microsoft --replacing ‘Microsoft Outlook’