Posted on 06-08-2021 02:48 AM
Hi all
I have tried this script from jamf it works locally but not being pushed
its an AD environment and it to redirect the music folder in documents
does anybody have experience of this
CURRENTUSER=$(stat -f %Su /dev/console)
ADUSER=$(id -F)
if [ "$CURRENTUSER" == "xmaadmin" ]; then
echo "xma admin, skipping folder redirection"
exit
fi
sleep 5
MYDOCDIR="/Volumes/homes$/"$ADUSER"/Documents"
echo $MYDOCDIR
if [ -d "$MYDOCDIR" ]; then
echo "$MYDOCDIR is Available!"
else
echo "$MYDOCDIR is Empty"
sleep 5
fi
ECHO ----------------- Redirecting Folders ---------------
sleep 4
ln -Ffhs "/Volumes/homes$/$ADUSER/Documents/My Music" "/Users/$CURRENTUSER/Music/GarageBand"
ECHO ----------------- Completed Script -------------------
killall Finder
exit
Posted on 06-11-2021 06:56 AM
It's possible that you will need to run the script in the user's context if running as a jamf policy. prepend the commands with /usr/bin/sudo -u ${CURRENTUSER}
For example: /usr/bin/sudo -u ${CURRENTUSER} ln -Ffhs "/Volumes/homes$/$ADUSER/Documents/My Music" "/Users/$CURRENTUSER/Music/GarageBand"
I haven't tested this but it's worth a shot.