Add SMB Network Share To Dock

jgidlund
New Contributor

Under configuration profiles I tried to add a dock item pointing to an SMB share (smb://servername/sharename) but I just get a big question mark in the dock. What is the best way to add a network share to the dock?

I know I can add a network mount as a login item but this doesn't work very good for mobile users that boot up their laptop and then VPN.

9 REPLIES 9

karthikeyan_mac
Contributor III

Create a webloc file and put it on the dock. We don't add it dock but we add to users desktop.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>URL</key>
    <string>smb://abc.yourservername.com/share</string>
</dict>
</plist>

Thanks,
Karthikeyan

jeremy_spolande
New Contributor

This allows for specifying cifs: over smb: where required, and may therefore make it genius, great, thanks.

cbrewer
Valued Contributor II

You might look into putting dockutil on your machines.

/usr/local/bin/dockutil --add smb://server/share/folder --label 'Network Share' --position end /Users/$user

ewu-it
New Contributor III

For those who might like the link to dockutil, you can find it here...
https://github.com/kcrawford/dockutil

--
Howard Griffith--Endpoint Systems Engineer--Eastern Washington University

jgidlund
New Contributor

Thanks for the posts everyone! Karthikeyan.mac, that PLIST that you posted doesn't seem to work when I add it as a custom setting under the configuration profile. Is there another way to deploy it out?

The preference domain I am using is "com.apple.dock".

jarednichols
Honored Contributor

wilsonch
New Contributor

@cbrewer

I have tried your script with dockutil and ran it as part of the login policy, and found that the script ran as "root" instead of the user, so my $user is root instead of the logged in user. Any idea how to fix this?

daz_wallace
Contributor III
Contributor III

Hi @wilsonch

I've added the following to our dockutil script to get it to work as the user:

username="$3"
    if [ -z "$username" ]; then       # Checks if the variable is empty (user running script from Self Service)
        username="$USER"
    fi
echo "User: $username"
dockutil="/etc/amsys/dockutil"

su "$username" -c "$dockutil --remove all"

su "$username" -c "$dockutil --add '/Applications/Microsoft Office 2011/Microsoft Word.app'"

etc

Hope that helps!

Darren

jcarr
Contributor III

Why not just use a profile to add an item to the Dock?Screen Shot 2021-09-03 at 3.46.47 PM.png

 

You can even use variables for the username etc.  If the device is bound, the user will already have a TGT (verify using klist) from AD.  If the device is not bound, you could use the Kerberos Single Sign-on Extension to get the user a TGT from AD.