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
66,581 times
Add to favorites
Office 365
E-mail Twitter Digg Facebook
Sign in to ask a question

  • Mapping to a different user/path
    3 Posts | Last post April 06, 2017
    • Hi,
      I want to be able to map a drive for all users to a specific/shared Onedrive for Business drive. If this possible as I cannot see how to do this?
      We already map H: home drives which works fine, so I was thinking to run a second script to do this if possible, or ideally merge in to the one.
    • You could probably just define that as a sharepoint site / path...should be sufficient, but haven't personally tried.
    • Hi thanks for the response. I tried this and it seemed to map the drive with no issues, although I get access Denied when trying to open it..saying about trusted sites etc, although the paths are already loaded in for the H: drive mapping. Guessing this must be permissions but Ive added a securoty group to the site permissions for this user so not sure why it still will not open... was a cry for help before I contact MS. Thanks
  • Proxy Authentication Required
    2 Posts | Last post April 04, 2017
    • I seem to be getting the above error when running this script. Wondering if anyone else has?
    • That basically means your proxy doesn't support the script, either use IE auth mode or disable your proxy.
  • Reconnectiong on logon
    3 Posts | Last post April 03, 2017
    • Hello,
      We're having issue with the drivemap not being reconnected on logon, it waits for the script to run again before connecting. Are we missing anything specific except $true on PersistentMapping? Do we have to sync some specific files with our Citrix UPM? Are we missing any specific GPO that are needed for it?
      Everything are working perfectly fine after the script is run (which takes like 5min after logon, I guess this is intended inside the script), just that we have some users that wants to have the folder ASAP after their first run with the script. I was first trying to get this done with the 2.57 version, but also just tried with the newer 3.06 version, but having no luck with the reconnect.
      Thanks alot!
    • You might want to sync the cookies folder, could help.
      In addition, the script should take <10 seconds to run if you use native auth mode in V3.06. If it takes longer, there might be another issue to fix :)
    • I found the reason why the script wasn't running immediately on logon, but still having issues with the reconnection part even though cookies are currently following my profiles. 
      Oh well, I can live with the script running directly after logon at least. I will try to get it set up for another customer and see if I will have better luck there with the same script then I can at least look for differences in the environments.
      Thanks anyways!
  • Cannot get past error failed to contact drive - any ideas?
    1 Posts | Last post March 30, 2017
    • I can run the script but get stuck at contacting X: and I cannot figure it out.  I can map a network drive so it is not permissions.  Any ideas?
  • SharepointMapping URL
    2 Posts | Last post March 29, 2017
    • I'm new to using this powershell and i think it's failing on the SharepointMapping.  Do I have the URL configured right on below ?
      $sharepointMappings    += ",ExampleLabel,Y:"
    • Doesn't look right to me :) site1? documentsLibrary? Examplelabel?
  • How to avoid password prompt
    6 Posts | Last post March 22, 2017
    • We are using Azure AD Connect to synchronize AD accounts to Office 365. This is for use in a computer lab at a school. The user profile gets wiped at logoff. I am trying to use your wonderful script, but I get a password prompt every time.  Is there a way to avoid the password prompt, or do I have to wait until we move to ADFS?
    • Hi,
      Well, I guess two options. Office 365 can only do integrated authentication if you have STS (like ADFS), or if you use AzureAD PassThrough. The latter is not yet supported as Microsoft hasn't been very forthcoming in helping me there.
      ADFS gives you single signon, and thus no need for a password.
      Until you have ADFS, the script really needs the user's password. Normally, it caches that in %APPDATA%, if you choose a different location that doesn't get wiped (homedrive for example), the script wouldn't have to keep prompting (unless the password was changed). The cache location can be configured in the script's configuration section.
    • Ok. It looks like I will have to convince our network engineer to go to ADFS for this. 
      Thank you very much for taking the time to answer, and for answering so quickly.
    • Interesting concept to add password file to home drive,we are using this but the issue we have is anytime the users accesses a different workstation it still prompts as it state password file is not valid !!
      so I am assuming we will need to wait till AzureAD passthrough is working ?
    • Hmm, the password file is encrypted using a local encryption secret, this means it can only be accessed from the same workstation I'm afraid.
    • Any chance of adding the option for clear password, so then this would work?
  • change the script to "sign in persistence"?
    6 Posts | Last post March 19, 2017
    • HI Jos
      I have mapping failure, during the ps run I saw following message:
      "Detected an url that indicates we've been signed in automatically:, but we did not select sign in persistence, this may cause an error when mapping"
      How can we change the script to "sign in persistence"?
    • Is it mapping correctly, or not? Did you do the userlookupmode change I suggested earlier?
    • 1. the mapping is correct
      2. yes I change the userlookupmode as you suggest (-eq instead of -le)
    • so there is no issue then ;)
    • sorry but I misguide you
      first I receive following:
      ERROR | Detected an url that indicates we've been signed in automatically: _com/_layouts/15/onedrive.aspx, but we did not select sign in persistence, this may cause an error when mapping.
      than I receive: 
      INFO | Mapping target:\\\DavWWWRoot\personal\user_domain_com\Documents
      ERROR: detected string error 224 in return code of net use command, this usually means your trusted sites are misconfigured or KB2846960 is missing
      ERROR | failed to contact O: after mapping it to \\\DavWWWRoot\personal\user_domain_com\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.
      BTW the trusted site is properly configured
    • Please take this to my blog, my contact info is there and I'd need the full log
  • Onedrive for business on-prem
    2 Posts | Last post March 19, 2017
    • Hey
      Does it work on on-prem? (Onedrive for business)?
      Thanks in advance
    • Hi Mike,
      not out of the box, it was designed for office 365, but it can certainly be modified for onprem.
  • Upload Limit 48Mb
    2 Posts | Last post March 05, 2017
    • Jos, this seems to be a default - does that come from SharePoint Online?
      Where can I increase this please?
      Greatly appreciate your script... it is awesome!
    • That's a Windows built in default, here's a KB that helps:
  • Mapping cannot continue because we could not log in to office365
    1 Posts | Last post March 02, 2017
    • Hi Jos,
      I do the change but still same error:
      ERROR | For some reason we're not at the logon page, even though we tried to browse there, we'll probably fail now but let's try one final time.
      INFO | Detected running explorer process
      INFO | Login attempt at Office 365 signin page
      INFO | Failed to find signin element type 1 on Office 365 login page, trying next method. Error details: Exception from HRESULT: 0x800A01B6
      INFO | Failed to find signin element type 2 on Office 365 login page, trying next method. Error details: Exception from HRESULT: 0x800A01B6
      ERROR | Failed to find signin element type 3 at You may have to upgrade to a later Powershell versio
      n or Install Office. Attempting to log in anyway, this will likely fail. Error details: Exception from HRESULT: 0x800A01B6
      INFO | attempting to trigger a redirect to SSO Provider using method 1
      ERROR | Failed to find the correct controls at to log in
      by script, check your browser and proxy settings or check for an update of this script. Exception from HRESULT: 0x800A01B6
      INFO | autoProtectedMode is set to True, reverting to old settings
      INFO | Setting zone 0 back to 3
      INFO | Setting zone 1 back to 3
      INFO | Setting zone 2 back to 3
      INFO | Setting zone 3 back to 0
      INFO | Setting zone 4 back to 0
      INFO | Automatically added to intranet sites for this user
      INFO | Automatically added to intranet sites for this user
      INFO | OnedriveMapper has finished running
      WARNING | restartExplorer is set to False, if you're redirecting My Documents, it won't show until next logon
91 - 100 of 192 Items