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
77,746 times
Add to favorites
Office 365
E-mail Twitter Digg Facebook
  • Trouble inside RDS / Citrix
    3 Posts | Last post October 06, 2015
    • Hi Jos, 
      Firstly thanks for taking the time to write this script.
      We have it working successfully on our managed locked down clients.
      However if I try and run the script from within our RDS / Citrix environment it isn't mapping the drive.  I see True twice and then it finishes.
      Investigating the logfile the first error is see is as follows:
      Failed to browse to the Office 365 Sign in page, this is a fatal error
      ERROR: attempt to navigate to https://[US] caused the IE scripting object to be nulled. This means your security settings are too high.
      Any ideas on what I should be checking ? 
      Best Wishes,
    • Hi, I resolved this issue. It was because I made a typing mistake in the field $O365CustomerName. 
      I have corrected that but I am now getting a different problem. Just running the script in Debug mode.  Would it be possible for me to send you the debug log ? If so what is the best way to do that?
    • Hi Andrew,
      You can send the logs to jo19lieben[DOT]nu
      replace 19 with the 19th letter of the alphabet and add a @ behind it. And replace [DOT] with the right character ;)
      Gotta keep spam away sorry....
  • We attempted to login without using ADFS...
    2 Posts | Last post September 17, 2015
    • Hi - this is predominantly working but getting a few of these errors below (I'm in a non-federated environment):
      Login attempt at Office 365 signin page
      attempting to trigger a redirect to ADFS
      1. No login splitter detected.
      We're still on the Office 365 page, no redirect was triggered thus not using ADFS
      2. No login splitter detected.
      We attempted to login without using ADFS, but did not end up at the expected location. Detected url:, expected URL:
      autoProtectedMode is set to True, reverting to old settings
      Any ideas?
      Also, one other thing - sometimes I get an O: drive with a red cross through it (when it has previously been Ok), I think the cookie has expired at that point but when the script is run it still thinks the O: drive is mapped so aborts - is this something you've seen?
      Once again, great stuff.
    • Hmm, I would need the full config and the full log, and would like to see what happens there in debug mode (with a PSR perhaps). But please use my blog to post that as I can see your email there and contact you if the logs are insufficient to help you.
  • Muliple ID's...
    2 Posts | Last post September 14, 2015
    • Was going to ask if you could take a look at the multiple ID issue but looks like you've already sorted - many thanks for this as I was having to run it in debug mode and ask certain users to manually select the account (only happened for one person but they happened to be important). Great stuff.
    • Glad to hear :)
  • UPN/Email not stores in AD...
    3 Posts | Last post July 10, 2015
    • Jos - Great script and this might seem a strange question but we don't store the email address required in any of the users attributes in AD - I'm going to try and ask for the email when it asks for the password, any pointers?? 
    • Cool. You could copy the CustomInputBox function and assign the value to $userUPN, I'd do some input validation though. To make it pretty, set $objTextBox.UseSystemPasswordChar = $False as well.
    • Yep...doing just that, just a matter of populating $userUPN from the text input...nearly there...cheers.
  • cached credentials
    3 Posts | Last post July 08, 2015
    • Any chance that you'll support the case where cookies cash one or more UPNs used to sign into Microosft on a computer? (resulting in buttons to choose among the accounts instead of username/password field)...
    • It already does in the cases I've tested. (I have 3 cached credentials). This is why the script logs out first.
      I do intend to add some additional checks because I've noticed that the new Windows 10 Azure / ADFS Workplace Join also does a form of SSO that currently only works in a 'clean' browser session, even forcibly logging out of both ADFS and O365 doesn't clear the cookie. I'll post an update on my blog when that version is done (I expect this month).
    • Vidar, an update has been posted :)
  • Substring Error
    3 Posts | Last post June 26, 2015
    • Hi Jos, when I run your great script, it give me the following error:
      Exception calling "Substring" with "2" argument(s): "Index and length must refer to a location within the string. Parameter name: length"
      In OneDriveAutoLoginAndMap.ps1:467 car:1
      + $userURL = $url.Substring($start,$end)
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
          + FullyQualifiedErrorId : ArgumentOutOfRangeException
      The goal seems to be reached because I find my new unit linked to SharePoint and it works but I don't know if error can create some problems.
      Do you know how can I resolve this error?
      Thank you so much.
    • Hi Luca,
      This is the part of the script that detects your username from the URL. Because it fails it defaults to your login user name, which is also fine as long as you don't change it :)
    • I've fixed this in in version 1.9 :)
  • Error Mapping Drive
    2 Posts | Last post April 22, 2015
    • Hey,
      I tried to run your script but failed.
      Can you point in the right direction of where the logs are so I can take a look?
    • Hi IceBun,
      I'm sorry, technet did not notify me of your comment or I'd have responded earlier. You can find the log by typing %APPDATA% in explorer or in the windows Run menu. 
191 - 197 of 197 Items