Posted on 05-09-2018 06:26 AM
Hi everyone.
I have been slowly preparing for the move for all our work Macs over to High Sierra for the summer break (Work at a college). I've run into a minor hiccup in that my test High Sierra builds do not appear to run the login script we have been using to add Active Directory home folders to the sidebar under Favourites.
Works fine with our El Capitan and Sierra builds and I also do not see any errors in any JAMF logs on the High Sierra test clients.
The script is as follows:
#!/bin/sh
# Get Current Logged in User
LoggedinUser=`ls -l /dev/console | cut -d " " -f 4`
# Set UserID as ID of logged in user
UserID=`id -u $LoggedinUser`
logger -t Jigsaw24 "$UserID"
if (( $UserID < 1000 )); then
logger -t Jigsaw24 "Local Account - nothing to do. Exiting Script"
exit 0
fi
# Get Domain
Domain=`dscl /Active Directory/ -read . | grep SubNodes | awk '{print $NF}'`
logger -t Jigsaw24 "Domain = $Domain"
# Extract Current Users Home
SMBHome=`dscl /Active Directory/$Domain/All Domains -read /Users/$LoggedinUser SMBHome | awk '{print $2}' | tr '' '?' `
logger -t J24 "SMB Home Output = $SMBHome"
# Change "?" to "/" and removes first 7 characters.
change1=`echo $SMBHome | cut -c 7- | tr '?' '/' `
echo "change1 = $change1"
logger -t J24 "change1 Output = $change1"
# Prefix "Change1" with "/Volumes"
prefix=`echo "/Volumes$change1"`
echo "prefix = $prefix"
logger -t J24 "prefix Output = $prefix"
PathtoHome=`echo $SMBHome | tr '?' '/' | cut -c 1-`
echo "PathtoHome = $PathtoHome"
logger -t J24 "Path to Home = $PathtoHome"
PathtoHome=$prefix
echo "PathtoHome Modified = $PathtoHome"
logger -t J24 "Path to Home Modified = $PathtoHome"
# Get current Sidebar Entries
CurrentSidebar=`sfltool dump-storage ~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.FavoriteItems.sfl`
logger -t Jigsaw24 "Current Sidebar = $CurrentSidebar"
# Check if Sidebar Entry Exists
SidebarExists=`sfltool dump-storage /Users/$LoggedinUser/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.FavoriteItems.sfl | grep -ci $PathtoHome`
logger -t Jigsaw24 "Check for Existing Home Sidebar = $SidebarExists"
if (( $SidebarExists > 0 ))
then
logger -t Jigsaw24 "Sidebar Entry already exists"
exit 0
else
logger -t Jigsaw24 "Adding Sidebar Entry"
output=`sfltool add-item com.apple.LSSharedFileList.FavoriteItems "file://$PathtoHome"`
echo $output
fi
Hopefully something simple to correct this but we've hit a wall over this so far. We thought it might have been a permissions issue but Authenticated User and Self groups have read access to the Student Users OU and subsequent folders.
Regards
Jody Welch
QESFC
Posted on 05-09-2018 07:51 PM
I also have a script that was adding mounts to the user's sidebar the same way you are doing which stopped working in High Sierra. Far as I can tell, sfltool had the add-item functionality removed entirely in High Sierra. I haven't found a way around that which doesn't involve 3rd party tools yet.
Posted on 05-14-2018 02:04 AM
What 3rd party tools have you tried out of interest?
Posted on 05-17-2018 08:10 AM
"mysides" was the only one I found that worked, but I haven't tried it on High Sierra. We're getting pretty good about telling people how to drag/drop a mount onto the sidebar, which natively remounts it if disconnected when clicked, so not being able to do this in a script hasn't really been a big deal anymore.