This is what I ended up doing if anyone is interested! Hopefully it can help someone else out. You'd have to write in any exceptions you want to account for with your environment.
- Self Service Policy Script w/restart immediately
#!/bin/bash
CURUSERNAME=`ls -l /dev/console | cut -d " " -f 4`
echo /Users/$CURUSERNAME > /.what_ever_you_want_to_name_this_file
echo "PLEASE DO NOT HIT THE ACCEPT BUTTON BELOW OR LOGIN!!! Your account is migrating. Your machine will restart again in a few minutes." > /Library/Security/PolicyBanner.txt
exit 0
- Startup Trigger Script:
#!/bin/bash
if [ -f "/.what_ever_you_want_to_name_this_file" ]
then
/usr/sbin/jamf policy MigrateLocalAccountToMobile
CURUSERPATH=`/usr/bin/awk '{print}' /.what_ever_you_want_to_name_this_file`
CURUSERNAME=${CURUSERPATH##*/}
UIDNUMBER=`id $CURUSERNAME | /usr/bin/awk -F 'uid=' '{print $2}' | /usr/bin/awk -F '(' '{print $1}'`
if [ $UIDNUMBER -lt 1000 ]
then
/bin/mv $CURUSERPATH /Users/OLD_$CURUSERNAME
/usr/bin/dscl . -delete /Users/$CURUSERNAME
/bin/mv /Users/OLD_$CURUSERNAME $CURUSERPATH
/usr/bin/defaults write /Library/Preferences/com.apple.loginwindow SHOWFULLNAME -bool true
/bin/sleep 2
/usr/sbin/chown -Rf $CURUSERNAME $CURUSERPATH
/bin/chmod -Rf 600 $CURUSERPATH
/bin/chmod -Rf u+rwX $CURUSERPATH
/bin/chmod og+rX $CURUSERPATH
/bin/chmod -Rf og+rX $CURUSERPATH/Public
/bin/chmod og=wX $CURUSERPATH/Public/Drop Box
/bin/chmod +a "user:$CURUSERNAME allow list,add_file,search,delete,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity,writesecurity,chown,file_inherit,directory_inherit" $CURUSERPATH/Public/Drop Box
system_profiler SPHardwareDataType | grep 'Hardware UUID' | awk '{print $3}'
rm -rf $CURUSERPATH/Library/Keychains/" & macUUID & "/*
security delete-keychain $CURUSERPATH/Library/Keychains/login.keychain
/bin/rm /.what_ever_you_want_to_name_this_file
/bin/rm /Library/Security/PolicyBanner.txt
/bin/sleep 2
/sbin/shutdown -r now
else
exit 0
fi
else
exit 0
fi
Note: These migration scripts does not account for local vs AD username differences, ours already match.