OneDriveMapper is a free, open source script I wrote which you can use as a logon or on demand script to map OneDrive for Business and/or Sharepoint Online to driveletters and/or Network Locations, it has been downloaded over 500,000 times, has millions of users and is also listed on Technet.
It was designed to run in scenario’s where using the Onedrive for Business client is not feasible, such as multi-user environments like Citrix or within a RemoteApp. Syncing in such environments is a bad idea as each user potentially has to re-sync data at each login and can potentially access other user’s data.
Download open source version:
Enterprise alternative (with support & discount):
What does OnedriveMapper do?
- Runs at logon or on demand (group policy, RES, etc)
- Maps to Onedrive for Business (with auto detection)
- Maps to Office 365 Groups (WITH auto detection of groups/teams)
- Maps to Sharepoint Online
- No Sync, online WebDav connection over HTTPS
- Connects seamlessly without user interaction
- Prompts for user password (only once) if no ADFS used
- On Demand Provisioning of the OneDrive MySite
- Detailed and configurable logging
- Can also map based on AD security groups
- Sets a customizeable label
- Can use custom library names
- Can also run on non domain joined machines or Workplace Joined machines
- Detects changed user names/url’s automatically
- Can map drives inside (Azure) RemoteApps or Citrix Seamless Apps
- Can redirect OS folders (like My Documents)
- SSO for MDM Intune AzureAD W10 devices
- Can be deployed as logon script through Intune
- Can easily run from a shortcut as well
- Office 365 licence
- Permission to map drives
- Permission to launch powershell scripts
- Exclude any mappings from scheduled virus scans
- Do not let windows search index mapped locations
- Disabled WebDav (WebClient) File Locking
- Migrate user homedirectories to O365 automatically first
- Remove the WebDav cache if it becomes too large
- Try not to have spaces in sharepoint library names
How to install
- Download the latest version at GitLab
- Add https://tenantname-my.sharepoint.com to your Trusted Sites list if mapping to O4B
- Add https://tenantname.sharepoint.com to your Trusted Sites list if mapping to Sharepoint Sites, O365 Groups or Microsoft Teams
- Add adfs.yourdomain.com to your local intranet sites (both http and https) to get SSO if you’re using ADFS. Make sure that whatever method you use to set this, runs BEFORE the script runs.
- Ensure Windows Authentication is enabled in Internet Explorer (this is default) if not using Native Auth
- Set $O365CustomerName to your Tenant Name (xxx.onmicrosoft.com)
- Set $userLookupMode to what matches your environment
- disable file locking
- Run it on a representative test machine / user and thoroughly check the log it generates in %APPDATA%
- Add the configured script to a Group Policy or deploy as MSI to make it run upon logon for all users, automatically mapping your OneDrive for Business webdav share to a driveletter.
- MFA support only in Native mode
- Okta ‘kinda’ works in IE mode, native not supported
- RMUnify ‘kinda’ works in IE mode, native not supported
- This script does not work Powershell V2 or lower (comes with Windows 7), install V3 or higher
I’m not a real programmer, this code is meant as a Proof Of Concept. I do not guarantee this product will work in your setup, and I offer no dedicated support, I try to help everyone on a best-effort basis but also have to work for a living. So make sure you test well and understand the code before you use it. This script may suddenly become obsolete without prior warning when Microsoft changes things. For an enterprise worthy and supported product, I strongly recommend using IAM Cloud Drive Mapper instead of an open source script. If you use LIEBEN25 as referral code with IAM Cloud, you’ll get a 25% discount.