Posted on 12-23-2014 12:26 PM
Hello All,
I am trying to figure out a way to have a shortcut to specific applications that we use in house. On the Windows side of the house we have a folder specific to our applications that we install. I am wondering if there is a way I could replicate this? It would just be a shortcut to applications : Chrome, Firefox, Word, Powerpoint, Excel and Outlook on the right side of the dock.
Thoughts?
Thanks in advance!
Solved! Go to Solution.
Posted on 12-23-2014 01:20 PM
This sounds like you need dockutil.
Pushing this out and then sending out scripts make this a simple task.
Posted on 12-23-2014 01:03 PM
What I did for my docs, is to build a the doc you want manually, then copy that configuration into the default user template. That way it will be created on initial login, and if they want, they can change it later.
Of course this doesn't really help you if the system is already in production and you want to just add a new doc item.
Posted on 12-23-2014 01:20 PM
This sounds like you need dockutil.
Pushing this out and then sending out scripts make this a simple task.
Posted on 12-23-2014 01:23 PM
If you do not want to use the build in dock items function in casper try dockutil maybe.
https://jamfnation.jamfsoftware.com/viewProduct.html?id=203&view=info
Edit: I've been beaten to it.
Posted on 12-23-2014 01:25 PM
Kyle sits a couple cubicles away, let me know if you need a spitball shot over at him. :)
Posted on 12-24-2014 12:52 AM
+1 for Dockutil. I run it in a script at an ongoing login policy to clear out the dock and add the items that are required.
Can also be combined with the 'not allow dock changes' MCX (I can't remember that exact wording!) and it stops users changing the dock but dockutil still works!
Hope that helps!
Darren
Posted on 12-24-2014 02:02 PM
Dockutil if you want it continually updating.
Built in OS X user template if you want it once off.
Look at the Dockutil scripts and documentation it shows just how little you actually need to add to the plist file when adding additional items, you can strip it right down to a basically human readable format with 4 or 5 lines per item.
Posted on 12-26-2014 12:49 PM
@donmontalvo Ask Kyle what the best way to get a bug report/inconsistent results sent to him...
Posted on 12-26-2014 01:14 PM
GitHub.
Posted on 12-26-2014 05:37 PM
Posted on 01-02-2015 08:11 AM
Thanks so much everyone.
This tool is awesome! Worked perfectly
Posted on 08-21-2018 09:25 PM
It appears dockutil only works on existing users, not future users in a lab setting, so it doesn't seem all that useful.
The built in dock settings are useless as there are no apps listed from inventory, vpp, etc, it's just some of the built in stuff.
JAMF failing again to actually have expected tools...
Posted on 08-21-2018 10:03 PM
@ebonweaver what are you trying to accomplish ?
dockutil is not a jamf product
Have you considered if policy execution frequency: "Once per user per computer" might meet your needs?
Posted on 08-22-2018 05:36 AM
I'm trying to create a custom dock, thought that was obvious. I can't, because there are no apps in the dock apps customization in JAMF other than some built in to the OS. Execution is irrelevant, the customization is not possible because JAMF fails to list available apps based on any criteria, like VPP inventory and software inventory from clients as expected. As a result, it's a useless option because you can't do anything with it if you actually install applications that you want in the dock. As a result, because this expensive solution once again falls woefully short, we must look to free 3rd party utilities to fill in the holes.
Posted on 08-22-2018 06:19 AM
You can create Custom Dock items in the JSS manually if you create a Policy > Dock Items > Dock Items Setttings > + New
This allows you to set the Dock Item name, type, and path to the app.
Personally I use dockutil and a login script that runs once per user per computer. I'm very thankful that JAMF makes this easy to deploy and execute.
Posted on 08-22-2018 08:03 AM
You might also consider Outset and docklib.
https://github.com/chilcote/outset
https://github.com/homebysix/docklib
Posted on 08-22-2018 08:17 AM
What @jaalvidr said. You might need to chain policies together, that is have one that installs the applications call your Dock policy when complete.
Posted on 08-22-2018 09:17 AM
I'm not sure what you folks are talking about. There are two options, one is Dock Apps, the other is Dock Items. Apps only lists preset apps in a drop down which does not include VPP and inventoried apps as expected, which makes this useless. Items has no explanation or documentation as to how it works. It is a single text field, there is no name, type, and path setting as you indicate. Therefore, adding files and folders as it is notated is not possible as there is no information how this works, and if it can be used for Apps that really is not noted or documented. If you have instructions that JAMF does not on how to use this, sharing would be most appreciated.
Posted on 08-22-2018 09:45 AM
Ah, got it. You're trying to do this from Configuration Profiles I think while the rest of us are likely just using Policies to accomplish this.
My suggestion is to use Policies for dock items instead. Here's an example script of a dock setup we deploy that uses dockutil. Assuming you have dockutil installed on the machine, this script when run at login will clear all dock apps/items and add Siri,System Prefs, Self Service, App Store, Chrome, iTunes, Photos, the Applications Folder, User Documents Folder, and User Downloads Folder.
#!/bin/bash
currentUser=`ls -l /dev/console | cut -d " " -f 4`
sleep 3s
sudo -u $currentUser /usr/local/bin/dockutil --remove all
sudo -u $currentUser /usr/local/bin/dockutil --add /Applications/Siri.app
sudo -u $currentUser /usr/local/bin/dockutil --add /Applications/System Preferences.app
sudo -u $currentUser /usr/local/bin/dockutil --add /Applications/Self Service.app
sudo -u $currentUser /usr/local/bin/dockutil --add /Applications/App Store.app
sudo -u $currentUser /usr/local/bin/dockutil --add /Applications/Google Chrome.app
sudo -u $currentUser /usr/local/bin/dockutil --add /Applications/iTunes.app
sudo -u $currentUser /usr/local/bin/dockutil --add /Applications/Photos.app
sudo -u $currentUser /usr/local/bin/dockutil --add /Applications/
sudo -u $currentUser /usr/local/bin/dockutil --add /Users/$currentUser/Documents/
sudo -u $currentUser /usr/local/bin/dockutil --add /Users/$currentUser/Downloads/
killall Dock
exit 0
Posted on 08-22-2018 11:48 AM
Is there a blog or instructions for how to use both outset and DockUtil for setting the dock once during a user's very first log in?
Posted on 08-22-2018 01:31 PM
Might be a blog or workflows out there somewhere, but I've found the best guidance on Slack (macadmins). There are #outset and #dock-management channels which are helpful.
Outset has a wiki:
https://github.com/chilcote/outset/wiki
https://github.com/chilcote/outset/releases
I'm not using DockUtil (messing w/ docklib), but I expect you would just place your DockUtil scripts in
/usr/local/outset/login-once/
Posted on 08-22-2018 02:17 PM
I use a LaunchAgent that launches a script.
#!/bin/bash
loggedInUser=$(/usr/bin/python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "
");')
dockPref="$HOME/Library/Preferences/com.yourcorp.dockbuilder.plist"
log="$HOME/Library/Logs/DockBuilder.log"
scriptName=$(basename "$0")
icon="/System/Library/CoreServices/Dock.app/Contents/Resources/Dock.icns"
# Array to hold all the items we need to add
# Note: if you need to add options you must seperate the item from the options with a @ symbol
# Example: "'/Library/Connect to...'@--view list --display folder --sort name"
declare -a itemsToAdd=(
"/Applications/System Preferences.app"
)
function writelog () {
DATE=$(date +%Y-%m-%d %H:%M:%S)
/bin/echo "${1}"
/bin/echo "$DATE" " $1" >> "$log"
}
function finish () {
# Kill our jamfHelper dialog
kill "$jamfHelperPID" 2>/dev/null; wait "$jamfHelperPID" 2>/dev/null
writelog "======== Finished $scriptName ========"
exit "$1"
}
function modify_dock () {
for item in "${itemsToAdd[@]}"; do
if [[ "$item" =~ @ ]]; then
params=${item##*@}
item=${item%@*}
/usr/local/bin/dockutil --add "$item" $params --no-restart 2>&1 | while read -r LINE; do writelog "$LINE"; done;
else
/usr/local/bin/dockutil --add "$item" --no-restart 2>&1 | while read -r LINE; do writelog "$LINE"; done;
fi
done
}
function office_icons () {
wordversion=$(defaults read "/Applications/Microsoft Word.app/Contents/Info.plist" CFBundleShortVersionString | awk -F. '{print $1}')
# Checking for Word/Office 2016
sleep 2
if [[ $wordversion -ge "15" ]]; then
writelog "Adding Office 2016 apps."
itemsToAdd+=("/Applications/Microsoft Word.app")
itemsToAdd+=("/Applications/Microsoft Excel.app")
itemsToAdd+=("/Applications/Microsoft PowerPoint.app")
itemsToAdd+=("/Applications/Microsoft Outlook.app")
else
# Checking for Office 2011
if [ -d "/Applications/Microsoft Office 2011/" ]; then
writelog "Adding Office 2011 apps."
itemsToAdd+=("/Applications/Microsoft Office 2011/Microsoft Word.app")
itemsToAdd+=("/Applications/Microsoft Office 2011/Microsoft Excel.app")
itemsToAdd+=("/Applications/Microsoft Office 2011/Microsoft PowerPoint.app")
itemsToAdd+=("/Applications/Microsoft Office 2011/Microsoft Outlook.app")
fi
fi
}
writelog " "
writelog "======== Starting $scriptName ========"
# Make sure DockUtil is installed
if [ ! -f "/usr/local/bin/dockutil" ]; then
writelog "DockUtil does not exist, installing..."
/usr/local/bin/jamf policy -event installLatestDockutil
if [ ! -f "/usr/local/bin/dockutil" ]; then
writelog "DockUtil installation failed, exiting."
finish 1
fi
fi
# We need to wait for the Dock to actually start
until [[ $(pgrep -x Dock) ]]; do
wait
done
# Check to see if the Dock was previously set up for the user
if [[ -f "$dockPref" ]]; then
writelog "Dock previously built on $(defaults read "$dockPref" build-date) at $(defaults read "$dockPref" build-time)."
finish 0
fi
# Display a dialog box to user informing them that we are configuring their Dock (in background)
/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "DockBuilder" -icon "$icon" -description "Your Mac's Dock is being built for the first time." &
jamfHelperPID=$!
# Hide the Dock while it is being updated
/usr/bin/defaults write "$HOME/Library/Preferences/com.apple.dock.plist" autohide -bool TRUE
/usr/bin/killall Dock
/bin/sleep 2
writelog "Clearing Dock."
/usr/local/bin/dockutil --remove all --no-restart
/bin/sleep 5
# Set up Dock for Admin
if [[ "$loggedInUser" == "admin" ]]; then
casperSuite="/Applications/Casper Suite/Casper Admin.app"
jamfPro="/Applications/Jamf Pro/Jamf Admin.app"
writelog "Setting up Dock for Admin user."
itemsToAdd+=("/Applications/Self Service.app/")
itemsToAdd+=("/Applications/Safari.app/")
itemsToAdd+=("/Applications/Google Chrome.app/")
itemsToAdd+=("/Applications/App Store.app/")
itemsToAdd+=("/System/Library/CoreServices/Applications/Directory Utility.app/")
itemsToAdd+=("/Applications/Utilities/Activity Monitor.app/")
itemsToAdd+=("/Applications/Utilities/Console.app/")
itemsToAdd+=("/Applications/Utilities/Terminal.app/")
itemsToAdd+=("/Applications/Utilities/Network Utility.app/")
itemsToAdd+=("/Applications/Utilities/Disk Utility.app/")
itemsToAdd+=("/Applications/Utilities/Keychain Access.app/")
itemsToAdd+=("/Applications/@--view grid --display stack --sort name")
if [[ -e "$casperSuite" ]]; then
itemsToAdd+=("/Applications/Casper Suite/@--view grid --display stack --sort name")
elif [[ -e "$jamfPro" ]]; then
itemsToAdd+=("/Applications/Jamf Pro/@--view grid --display stack --sort name")
fi
itemsToAdd+=("/Library/Connect to...@--view list --display folder --sort name")
/usr/bin/defaults write "$HOME/Library/Preferences/com.apple.dock.plist" 'orientation' -string 'left' # Position the Dock to the left
# If user is a student configure a slim Dock
elif [[ "$(id "$loggedInUser" | awk '{print tolower($0)}')" =~ all-es-students|all-ms-students|all-hs-students ]]; then
writelog "User is a student, setting up a student Dock."
itemsToAdd+=("/Applications/Safari.app/")
itemsToAdd+=("/Applications/Google Chrome.app/")
# If user is not a student configure a more full Dock
else
writelog "User not a student, setting up full Dock."
itemsToAdd+=("/Applications/Self Service.app/")
itemsToAdd+=("/Applications/Safari.app/")
itemsToAdd+=("/Applications/Google Chrome.app/")
itemsToAdd+=("/Applications/@--view grid --display stack --sort name")
itemsToAdd+=("/Library/Connect to...@--view list --display folder --sort name")
# Add Office icons
office_icons
fi
# Add ~/Downloads folder as the last array element then add all items to dock with function
itemsToAdd+=("$HOME/Downloads")
modify_dock
# Create a file to track the creation of the Dock
writelog "Creating DockBuilder user preference file."
/usr/bin/defaults write "$dockPref" build-date "$(date +%m-%d-%Y)"
/usr/bin/defaults write "$dockPref" build-time "$(date +%r)"
# Reset the Dock
writelog "Resetting Dock."
/usr/bin/defaults write "$HOME/Library/Preferences/com.apple.dock.plist" autohide -bool FALSE
/usr/bin/killall Dock
finish 0
Posted on 08-22-2018 03:43 PM
I use a launch agent that runs a script as well. It generates a flag file so it only runs once for each user (this was created prior to once per user per computer working correctly in JAMF).
Has worked perfectly for several years now.