OneDriveMapper automatically map your OneDrive for Business upon login

This script maps your Onedrive / Sharepoint / Teams document libraries to driveletters (or shortcuts). It can be used in any environment (VDI, RemoteApp, w10 etc).

4.6 Star
62,824 times
Add to favorites
Office 365
E-mail Twitter Digg Facebook
Sign in to ask a question

  • Logon failures... works after repeated retries
    5 Posts | Last post August 18, 2017
    • Here is a log Jos - this was working fine until the weekend. Prompts for password, fails twice and works the third time - any idea? - Regards, Andrew
      (I can't fit the log in here... how can I send it?)
      I hooked up with you on LinkedIn yesterday - will try that channel...
      Here is key item from the log. Note same password entered each time:
      08/07/2017 12:27:50 | INFO | Retrieved user password from cache C:\Users\xxxx\AppData\Roaming\OneDriveMapper.tmp
      08/07/2017 12:27:54 | ERROR | There was an issue while trying to log in during attempt 1
      08/07/2017 12:27:54 | INFO | Signin Option persistence selected
      08/07/2017 12:27:54 | INFO | asking user for password
      08/07/2017 12:28:01 | INFO | Stored user's new password to user password cache file C:\Users\xxxx.davidson\AppData\Roaming\OneDriveMapper.tmp
      08/07/2017 12:28:03 | ERROR | There was an issue while trying to log in during attempt 2
      08/07/2017 12:28:03 | INFO | Signin Option persistence was already selected
      08/07/2017 12:28:03 | INFO | asking user for password
      08/07/2017 12:28:07 | INFO | Stored user's new password to user password cache file C:\Users\xxxx.davidson\AppData\Roaming\OneDriveMapper.tmp
      08/07/2017 12:28:09 | ERROR | There was an issue while trying to log in during attempt 3
      08/07/2017 12:28:10 | INFO | detected user logged in Tile in IE
      08/07/2017 12:28:15 | INFO | login detected, login function succeeded, final url:
      08/07/2017 12:28:15 | INFO | IE login function succeeded
      08/07/2017 12:28:27 | INFO | Detected user: xxxx_davidson_compxyz_org_au
      08/07/2017 12:28:27 | INFO | Onedrive cookie generated, mapping drive...
      08/07/2017 12:28:28 | INFO | Mapping target: \\\DavWWWRoot\personal\xxxx_davidson_compxyz_org_au\Documents
      08/07/2017 12:28:28 | INFO | A drive label has been specified, attempting to set the label for O:
      08/07/2017 12:28:28 | INFO | Label has been set to Onedrive
      08/07/2017 12:28:28 | INFO | O: mapped successfully
    • Jos, I think the reason this is happening now is that the Windows 2012 R2 server is falling back to legacy mode (suddenly) for some reason. Can you please run though for me the checks needed to make sure native mode will work on 2012 R2 server? That would be greatly appreciated... - cheers, Andrew
    • I'm getting the same issue. I notice that if I hard code the password, it works fine. However, retrieving the password from the encrypted .tmp file is not working (the file is in the correct spot and it is found by the script).
      Any ideas?
    • I found a fix to my issue of being asked for the password multiple times when using an excrypted file (hard coded pw worked fine).
      The login URL seems to have changed. With debugging on, I could see the microsoft login page re-load a second time. I copied the URL (which is quite long) and replaced the current one ( in the script with it ( The mapping now works and I'm not asked for a password multiple times.
      I will not put the whole URL here as I'm not sure what potential user account info it could contain. You can get the URL yourselves as I did though.
      I hope this will help others as well. Do let us know.
    • Dear friends,
      I had the same experience with the OnedriveMapper suddenly not working anymore. This morning we found out that it had to do with the new log-in experience of Microsoft for Internet Explorer. I set my log-in back to the old experience and the program is working as it Always did.
  • One Drive is not getting Mapped.
    2 Posts | Last post August 09, 2017
    • Hi Jos,
      We are using onedrivemapper v2.49 to map one drive as Y drive to users. After user logs in to the session mapper runs and asked for the Office 365 password. Once user provided the password after that mapped gets closed and through a message " Mapper cannot continue because we could not log in to Office 365". However user is able to access onedrive by using web portal that means they have the proper access to the onedrive.
      Here are some of the logs we have taken. Please help how this can be resolved.
      ERROR: WebDav File Locking support is enabled, this could cause files to become locked in your OneDrive or Sharepoint site
      Adding to mapping list: Y: (\\\DavWWWRoot\personal\)
      Y: is not yet mapped
      Base URL: 
      Starting logon process at:
      Login attempt at Office 365 signin page
      Found sign in elements type 1 on Office 365 login page, proceeding
      attempting to trigger a redirect to SSO Provider using method 1
      Signin Option persistence selected
      waited for more than 10 to get redirected by SSO provider, attempting normal signin
      Signin Option persistence selected using normal element
      Retrieved user password from cache \\XXXXXXX\profilestore\username\AppData\OneDriveMapper.tmp
      We attempted to login without using ADFS, but did not end up at the expected location. Detected url: https://
    • We had hte same problem with this, we download the latest version v3.10 and it fix our issue
  • OneDrive Mapping Error
    1 Posts | Last post August 04, 2017
    • Great script, but in the last week it has stopped working. I downloaded version 3.10 today and am testing it out, but still getting connection error while trying to connect. 
  • AzureAADConnect SSO Error 224
    3 Posts | Last post August 02, 2017
    • First off, thanks for creating such an awesome tool.
      We are getting the following logs when trying to use v3.09
      08/02/2017 12:39:55 | INFO | -----08/02/2017 12:39:55 OneDriveMapper v3.09 - jerry on RTP34 starting-----
      08/02/2017 12:39:55 | INFO | Script elevation level: User
      08/02/2017 12:39:55 | INFO | Set TLS protocol version to 1.2
      08/02/2017 12:39:55 | INFO | You are S-1-5-21-1960408961-746137067-839522115-4651 running on Windows 6 with IE 11 and Powershell version 3
      08/02/2017 12:39:56 | INFO | NOTICE: you are running the latest (v3.09) version of OnedriveMapper
      08/02/2017 12:39:56 | INFO | Loading CookieSetter...
      08/02/2017 12:39:56 | INFO | Test cookie set successfully
      08/02/2017 12:39:56 | INFO | NOTICE: HKLM:\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\Security HKLM only not found in registry, your zone configuration could be set on both levels
      08/02/2017 12:39:56 | INFO | NOTICE: found in IE Trusted Sites on user level
      08/02/2017 12:39:56 | INFO | NOTICE: found in IE Trusted Sites on user level
      08/02/2017 12:39:56 | INFO | IE Automatic Proxy Detection is not yet disabled, attempting to disable...
      08/02/2017 12:39:56 | INFO | IE Automatic Proxy Detection disabled
      08/02/2017 12:39:56 | INFO | userLookupMode is set to 1 -> checking Active Directory UPN
      08/02/2017 12:39:56 | INFO | Login for caching supplied, not querying user for login
      08/02/2017 12:39:57 | INFO | Stored user's new login to user login cache file 
    • 08/02/2017 12:39:57 | ERROR | ERROR: WebDav File Locking support is enabled, this could cause files to become locked in your OneDrive or Sharepoint site
      08/02/2017 12:39:57 | WARNING | Maximum file upload size is set to 48 MB
      08/02/2017 12:39:57 | INFO | Not mapping O4B because dontMapO4B is set to True
      08/02/2017 12:39:57 | INFO | Adding to mapping list: Q: (\\\DavWWWRoot\sites\rtp-est\Shared Documents)
      08/02/2017 12:39:57 | INFO | Q: is not yet mapped
      08/02/2017 12:39:57 | INFO | Base URL: 
      08/02/2017 12:39:57 | INFO | Login attempt using native method at tenant mrwpca1
      08/02/2017 12:39:57 | INFO | Received API response for authentication method: Managed
      08/02/2017 12:39:57 | INFO | Additionally, Azure AD SSO and/or PassThrough is enabled for your tenant
      08/02/2017 12:39:57 | INFO | Authentication target:
      08/02/2017 12:39:57 | INFO | Azure AD SSO response received: AQABAAAAAAA9kTklhVy7SJTGAzR-p1BcTBO_EmJ7jPXcq0pPYO0chPPG3g8-Uq5bPUQE6AIN3mndVNu2e5T73t19AZWMILDCl_MVmuVFgmV3rSmDBRjlTE6lJyjBV0jfQ4CeJrONd2e8PLSzirbJRdGPLQDxnNr6o1YloGxq6_BWsU2vtA4jNvzLfXWGihMR96ZnTH4Lz54c36wbTxweR_3aIfI3udxTDROH7Iz3VPi264ddK0XSx2Yz8z8lQ1xwWnS_JcL3Vf8IPNE3OujTQsiAikgUwLjWSHfS-diN-kCWb3B2-HLSwdQxfZ0VLMVTTV8Dv9LDv7sgAA
      08/02/2017 12:39:57 | INFO | AADC SSO step 1 completed
      08/02/2017 12:39:57 | INFO | Requesting session...
      08/02/2017 12:39:57 | INFO | Checking if we've been Signed in automatically by Azure AD PassThrough...
      08/02/2017 12:39:57 | WARNING | We do not seem to have been properly redirected for SSO yet
      08/02/2017 12:39:57 | INFO | New sts request retrieved
      08/02/2017 12:39:57 | INFO | New flowToken retrieved
      08/02/2017 12:39:57 | INFO | New canary retrieved
      08/02/2017 12:39:57 | INFO | New apiCanary retrieved
      08/02/2017 12:39:58 | INFO | AADC SSO step 2 completed
    • 08/02/2017 12:39:58 | INFO | Checking if we've been Signed in by Azure AD
      08/02/2017 12:39:58 | WARNING | We do not seem to have been properly redirected for SSO yet
      08/02/2017 12:39:58 | ERROR | We do not seem to have been properly redirected after signing in.
      08/02/2017 12:39:58 | INFO | Initiating session with:
      08/02/2017 12:39:58 | INFO | Retrieving Sharepoint cookie step 1...
      08/02/2017 12:39:59 | ERROR | Problem reported during step 2: no next url detected: -1
      08/02/2017 12:40:01 | INFO | SpO cookie generated, attempting to map drive
      08/02/2017 12:40:01 | INFO | Mapping target: \\\DavWWWRoot\sites\rtp-est\Shared Documents
      08/02/2017 12:40:02 | ERROR | ERROR: detected string error 224 in return code of net use command, this usually means your trusted sites are misconfigured or KB2846960 is missing
      08/02/2017 12:40:02 | ERROR | failed to contact Q: after mapping it to \\\DavWWWRoot\sites\rtp-est\Shared Documents, check if the URL is valid. Error: 
       System error 224 has occurred. 
       Access Denied. Before opening files in this location, you must first add the web site to your trusted sites list, browse to the web site, and select the option to login automatically.
      08/02/2017 12:40:02 | INFO | OnedriveMapper has finished running
      08/02/2017 12:40:02 | WARNING | restartExplorer is set to False, if you're redirecting My Documents, it won't show until next logon
      We have AzureADConnect SSO running, so basically the user's email address is automatically populated in the O365 form, and if you tab down to the password field it logs in.
      Is there a way to avoid this 'Error 224' or is this type of SSO not supported?
  • cant map drive
    2 Posts | Last post July 20, 2017
    • Hi Jos 
      I need help
      I running a script and receive 
      ERROR | We do not seem to have been properly redirected after signing in.
      ERROR | fallback mode is enabled, and login failed. Attempting IE auth mode.
      at end of running script pop up error:
      Mapping cannot continue because we cannot detect your username 
    • download the latest version from my blog, it was fixed in v3.09 after a change by MS
  • OneDriveMapper not working with RMUnify
    2 Posts | Last post July 14, 2017
    • Hi Jos,
      I'm trying to get this script working with RMUnify, but am getting exactly the same error message as one of the other users here:
      It throws the errors:
      Exception calling "Substring" with "2" argument(s): "Length cannot be less than zero.
      Parameter name: length"
      Method invocation failed because [System.Int32] does not contain a method named 'IndexOf'.
      Exception calling "Create" with "1" argument(s): "Invalid URI: The format of the URI could not be 
      From your notes in the script I can see that you have support for RMUnify so are you able to offer any further advice?
      Many thanks in advance,
    • Last time I did anything around RMUnify, it was in IE auth mode, native auth mode won't work with RMUnify until I do dev on it, which I most likely won't as I don't have RMUnify :)
  • WebDAV Space Reporting
    4 Posts | Last post June 28, 2017
    • Hello.
      First, thank you for this excellent script.
      Second, Question - the known WebDAV issue (by design) about not reporting the true space available and instead mirroring the space on the System drive - does this actually limit the amount of storage available, or would the full amount of space (In the case of OFB - 1 TB) be available?
    • Its all available :)
    • Thanks!
    • hi, it seems that it is not like this. I mean if it shows that you have 4 GB free based on your drive C, you really have only 4GB. I just checked it. Am I doing something wrong?
  • Can't run from shortcut
    1 Posts | Last post June 23, 2017
    • Great script that works when I run it manually, but I'm trying to get it to run from a shortcut and all I get is a quick flash of the command prompt and then nothing.
      Shortcut target is:
      C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -WindowStyle Hidden -ExecutionPolicy ByPass -File “C:\Program Files (x86)\OneDriveMapper\OneDriveMapper_v1.ps1”
      I tried using %SystemRoot% instead of C:\Windows but it doesn't make a difference.
      I even set the execution policy to unrestricted but it didn't help.
      Thanks in advance for any guidance!
  • Hi Jois
    1 Posts | Last post June 22, 2017
    • Thanks for script. It works as expected for mapping OneDrive for some users but it fails on certain users . Please find below the error log.Will you be able to help me here. Note i have changed my company and user details.
        | INFO | IE login function succeeded
        | INFO | Attempting to detect username at, waited for 0 seconds
      06/22/2017 14:29:53 | INFO | Attempting to detect username at, waited for 2 seconds
  • Does mapped drive takes away local disk space ?
    4 Posts | Last post June 18, 2017
    • I know that "by design" mapped drive mirror local disk drive but does it take local disk space as my tests seems to indicate ? Is there a way "not to sync" on local drive what ever I put in the mapped drive ? Am I missing something ?
      First off I am no savvy tech but I try to find ways to save my non-profit clients every penny I can. Most of them are on a workgroup setup fashion and like regular business they need security, means of backup, file sharing and so on but at a fraction of the cost. I try to set them up so they don't have to pay huge monthly bills in order to operate their computing environment.
      So I am always excited to figure out ways of simplifying computing process and onedrivemapper could be a nice solution for sharing and/or backup purposes.
      Thanks !
    • Seems to me that you ALSO have OD client installed. And that one does the sync. Uninstall OD client & use ONLY ODMapper
    • Yes you got that right but I tried it on another machine and it did take space locally. So you say it's not supposed to do that right ?
    • It is DIRECT drive mapping, not sync, so it does NOT take any local space!
61 - 70 of 191 Items