Please test this as we don't use the application so I don't have a way to test it.
#!/bin/bash
loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`
#quit box sync
sudo pkill boxsync
#Copy old data
cp "/Users/$loggedInUser/Box Sync" "/Users/$loggedInUser/Desktop/Box Sync (OLD)"
# Remove old Files
rm -rf "/Users/$loggedInUser/Library/Logs/Box/Box Sync/"
rm -rf "/users/$loggedInUser/Library/Application Support/Box/Box Sync/"
rm -rf "/Library/PrivilegedHelperTools/com.box.sync.bootstrapper"
rm -rf "/Library/PrivilegedHelperTools/com.box.sync.iconhelper"
Executing Policy Uninstall Box Sync
Running script Uninstall Box Sync...
Script exit code: 0
Script result: cp: /Users/royjovero/Box Sync is a directory (not copied).
@royjovero change that one to cp -R instead of just cp
@Asnyder
Executing Policy Uninstall Box Sync
Running script Uninstall Box Sync...
Script exit code: 0
Script result:
Submitting log to https://casper.itjones.com:8443/
@royjovero Looks like it worked then. Just make sure everything happened on the client machine that should have.
In light of Box Drive slowly becoming the de facto client software, I wanted to add a bit to this thread.
Box Drive throws up a warning if Box Sync is installed, even when deployed via Self Service/Jamf. I made some modifications to the above script to completely kill and remove Box Sync because some things appear to have changed since it was created. For my environment, we don't touch the Box Sync folder to prevent any data loss or panicking, but I left it to keep things consistent
#!/bin/bash
#Set the variable for the currently logged in user
loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`
#Quit Box Sync
killall "Box Sync"
#Copy old user data. Change cp to mv if you prefer to move it
cp "/Users/$loggedInUser/Box Sync" "/Users/$loggedInUser/Desktop/Box Sync (OLD)"
# Remove old Box Sync application data
rm -rf "/Applications/Box Sync.app"
rm -rf "/Users/$loggedInUser/Library/Logs/Box/Box Sync/"
rm -rf "/users/$loggedInUser/Library/Application Support/Box/Box Sync/"
rm -rf "/Library/PrivilegedHelperTools/com.box.sync.bootstrapper"
rm -rf "/Library/PrivilegedHelperTools/com.box.sync.iconhelper"
In my testing/pilot, the Box Drive app is deployed through Self Service with the script running before. No errors from the uninstall/install, and data is intact.
@dcgagne might want to dump the receipts, by adding to your script something like:
boxReceipts=$(pkgutil --pkgs=<receiptName>*)
for r in $boxReceipts;
do
pkgutil --forget "$r"
done
The next version of Box Drive's installer will include a way to automatically uninstall Box Sync. Info here: https://community.box.com/t5/Getting-Started-with-Box-Drive/Uninstalling-Box-Sync-Using-the-Box-Drive-Installer/ta-p/66249?
@float0n wow thanks for the heads up, looks like they're thinking like enterprise folks. :)