Removing AD Home Folder from Dock

Andrina
Contributor
Contributor

So I've been digging about for this one for a couple days with ML and wanted to see if anyone else was trying similar. Specifically, I'd like to retain having the UNC path for the SMB home mounted for end users, but due to some access permissions and the way home folders get mounted from DFS we end up with a "?" in our dock. The AD plugin appears to create a managed preference for the dock on first login of a user. I've tried removing the dock portion of /Library/Preferences/OpenDirectory/Configurations/Active Directory/DOMAIN.plist, and while I thought I'd had some initial luck with this, I can't reproduce it working with a first run script:

/usr/libexec/PlistBuddy -c "Delete :module options:ActiveDirectory:managed client template:mcx_application_data:com.apple.dock" /Library/Preferences/OpenDirectory/Configurations/Active Directory/PRODUCTION.plist

It does delete the array, but the managed preference is still written for the user. Incidentally, deleting/modifying com.apple.dock.plist from the /Library/Manages Preferences/username results in the file being re-written the next time the user logs in.

Has anyone else come across this and had more success?

1 ACCEPTED SOLUTION

jarednichols
Honored Contributor

I assume you've got the UNC path selected in the AD plugin. If you specifically aren't using the portable home folder functionality, you could un-tick that box and instead use a script to mount SMBHome and plop it on the Dock for the user for the first time. Then it's on the Dock and not a pesky managed preference that isn't terribly flexible.

View solution in original post

7 REPLIES 7

jarednichols
Honored Contributor

I assume you've got the UNC path selected in the AD plugin. If you specifically aren't using the portable home folder functionality, you could un-tick that box and instead use a script to mount SMBHome and plop it on the Dock for the user for the first time. Then it's on the Dock and not a pesky managed preference that isn't terribly flexible.

Andrina
Contributor
Contributor

Ah, yes... good thought - going for OriginalHomeDirectory instead of SMBHome here given it's closer to the right format after a bit of sed fun...

dscl localhost read /Active Directory/DOMAIN/All Domains/Users/$username OriginalHomeDirectory | awk '{print $2}' | sed 's/<home_dir><url>//g' | sed 's/</url><path>/</path></home_dir>//g'

Thanks!

Andrina
Contributor
Contributor

For future reference, in case anyone else needs to do the same... Works nicely - just replace with your domain in the case of the dscl command...

#!/bin/bash

#Mount a users home directory outside of the AD Plugin UNC Path
SMBPATH=`dscl localhost read /Active Directory/DOMAIN/All Domains/Users/$3 OriginalHomeDirectory | awk '{print $2}' | sed 's/<home_dir><url>//g' | sed 's/</url><path>/</path></home_dir>//g'`

#Make the users home folder and mount it
mkdir /Volumes/$3
mount -t smbfs $SMBPATH /Volumes/$3

#Place it in the Dock for the user
defaults write com.apple.dock persistent-others -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Volumes/$3</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"
#restart the Dock to make sure it's there
killall Dock

tlarkin
Honored Contributor

Hey Andrina,

If the AD home folder maps properly in dscl, you can drop the sed logic, and just use:

dscl . read /Users/$3 SMBHome

that should output the full SMB home folder path. If that doesn't work you can use the sed wizardry. :-)

Thanks,
Tom

jarednichols
Honored Contributor

Hey, sed wizardry is always good for sed wizardry's sake.

rockpapergoat
Contributor III

keep it simple…

sam_clark
New Contributor III

Hey all,

I just followed up on this issue in case you are using Mobile Home folders and the mobility option with configuration profiles.

Check out the discussion below.

https://jamfnation.jamfsoftware.com/discussion.html?id=10753#responseChild74375