So you’re running a macOS shop, and using Office 365 for identity, email, and data storage. You want to decrease risk of data loss, manage the security of corporate data, and provide staff the ability to share files in a controlled manner.
You also want to make it super easy for staff to adopt.
Microsoft OneDrive has a super great feature (for Windows) called Known Folder Move. This redirects the Desktop, Documents, and Pictures folders to your OneDrive folder.
The generous Brian McFarlane has graciously provided the community with a package which configures KFM for macOS workstations. The package depends on ‘Outset’, which is a script that “automatically processes packages, profiles, and scripts during the boot sequence, user logins, or on demand.“
The KFM script is triggered on user logon to perform the following:
- Check if OneDrive is running, and the OneDrive folder exists (user is signed into OneDrive)
- Check if the ‘Desktop’ and/or ‘Documents’ folders in user home are a symlink, and if so, end the script
- If they aren’t, then move ‘Desktop’ and ‘Documents’ into the OneDrive folder and create symlinks. If any conflicting files are found, they’re placed in the user’s ‘Desktop’ folder and the user is alerted.
- If configured, filenames in ‘Desktop’ are cleaned up (illegal chars, leading/trailing spaces, etc…)
This is great, and works amazingly well. I found no scenarios where any data loss was encountered. YMMV though, so don’t blame me if it sets fire to your cat.
I did have a problem with this though. After the ‘Desktop’ and ‘Documents’ folders were moved and linked, the Finder sidebar shortcuts stop working. I found the aptly named ‘mysides‘ which is a small CLI tool to modify Finder sidebar entries.
With mysides installed, the KFM script can be told to fix this for us. You can find the changes here: https://github.com/nmanzi/MacOS-OneDrive-KFM/blob/42057dc46680f8dfcfbe8d641e63dd2139088aef/payload/usr/local/outset/login-privileged-every/onedrive-kfm.sh#L134
I have a fork and release for the updated KFM which requires both Outset and mysides to be installed as prerequisites.
Hope this helps!