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
73,605 times
Add to favorites
Office 365
E-mail Twitter Digg Facebook
  • Access Denied error for OneDrive business
    3 Posts | Last post March 17, 2016
    • Hi Jos,
      I am trying to map one Drive for business and gave all the parameters correctly. But in the log it shows this error 
      "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."
      Any idea would be much appreciated.
    • Were you perhaps already logged in to Office 365? Run the script in debug mode and see if it does or doesn't check that checkbox.
    • Hey Jos,
      Your script is perfect. The error I get is due to some Microsoft issue for which I got the hotfix. After installing it I am able to map the drive well.
  • Hi Jos
    2 Posts | Last post March 16, 2016
    • Great ps.  The onddrivemapper has finished running but doesn't show within explorer.  HKCU shows the drive letter of X: and within a cmd session I can call x:?  Any ideas why it's not showing within Explorer.  Windows 10 with dirsync (ADFS).  Also to note with the x: drive mapping back to my onedrive is there away to add another driver letter for O365 site. Say S: going back to  If so could you point me in the right direction on the additional code.
    • Hi Boots,
      the drive is invisible because you're running the script in elevated mode. I added a workaround for that using a Microsoft KB, but apparently in your case it isn't working? You could try setting restart_explorer to $True.
      at line 80 in the script configuration you can add as many sharepoint libraries as you wish to be mapped to driveletters.
  • Can't map
    2 Posts | Last post March 16, 2016
    • Hi Jos,
      I work at a university and would love to get this script working for a lab.  I keep trying but the process keeps aborting.  Can I send you a log/the script and see what I'm doing wrong?  A clue:
      Failed to find /personal/ 
    • You can email the log to josliebennu with the right characters between sl and nn
  • Sharepoint Mapping - Only first layer visible
    2 Posts | Last post March 08, 2016
    • Hello 
      I used the script with the noO4B Option. Now the Sharepointmapping is done and i see all my mappings in the Explorer. I can go on the networkdrive and there i see my folderstructure. As soon as i try to go into a Folder, the Folder is empty like i have no permissions to see the Content of the subfolders?
      Any ideas to get that fixed?
    • Hmmmm, i haven't seen that before. Is it a standard document library without customization? And you have permissions i assume?
  • One Drive Mapping mirrors the C Drive Space left
    3 Posts | Last post February 29, 2016
    • Hi Jos
      Great script!:)
      We have some fairly full C Drives on PCs\laptops. The user tries to copy files from an external USB directly into the one drive mapping. If the files been copied are greater in size that the space left on the C Drive it complains as the One drive mapped drive is mirroring the actual space left on the C: drive.
      Just wondering is there any way around of preventing the One drive mapping from mirroring the C Drive and actually showing the real space that is left on One Drive?
    • I'm afraid that that is a bug in the webdav client which i have no workaround for, sorry :(
    • None the less great script and thanks again :)
  • Unable to find personal
    4 Posts | Last post February 10, 2016
    • Hello Jos, 
      I'm looking forward using this awesome script!
      We use ADFS and after logging in, the user is redirected to
      I'm not sure how your script retrieves the url to O4B. we get the following log entries:
      You were already logged in, skipping login attempt, please note this may fail if you did not log in with a persistent cookie
      Failed to find /personal/ in the URL:, waiting 5 seconds and trying again
      Your help is very much appreciated!
    • Strange, if I do the exact same (browsing to I always end up at my onedrive URL, OR at the provisioning URL if it wasn't provisioned yet. I've seen the same behavior at numerous other users.
      Did you customize the relaying party trust in ADFS somehow? What do you see at the default.aspx page?
    • Correct, apparently we have set another page as homepage in mysites, so the user will end up in
      I guess this will make it hard to retrieve the O4B url.
    • True, but generally, nothing is impossible, probably just a little customization :)
  • Windows Auth for onedrive login.
    2 Posts | Last post February 10, 2016
    • does this script work with windows auth. I have AD Sync for all account instead of ADFS.
    • absolutely :)
  • Mapped Drive Only Visible If Run Manually
    4 Posts | Last post February 03, 2016
    • Hi. This looks to be a great script, but I'm experiencing a problem. When running as a logon script, the log file believes the drive has been mapped successfully but it's invisible. If the same user manually runs the script, the exact same log entries exist and yet the drive is visible.
      I have tried $restart_explorer but it makes no difference.
      Any ideas?
    • Even if you manually restart explorer.exe? And you can see them with a net use in an elevated prompt?
      If so, then my fix for that apparently doesn't work for you for some reason....
      Do the registry keys for the drive under HKCU\Network get populated?
    • Hi Jos,
      Thanks for the reply - weirdly, without changing anything, the drive DOES now appear when run as a logon script but it says it's disconnected with the error
      "Web Client Network: Access Denied. Before opening files in this location, you must first add the web site to your trusted sites list, browse to the website, and select the option to login automatically. This connection has not been restored."
      In debug mode, I can clearly see your script selecting the login automatically option. The log still suggests that the drive has been mapped successfully, and the same user is able to run the script manually and have the drive available.. 
      I tried adding a 10s pause at the start of the script when it's a logon script in case it was something which wasn't ready but that hasn't made a difference.
      Do you have any other suggestions?
    • I would need your log file to further determine the cause, you can send it to josliebennu where you can insert the proper characters between sl and nn
  • Check group membership?
    3 Posts | Last post February 02, 2016
    • Hi Jos,
      First of all, thank you! This is a such great script, quite efficient and it does what I was looking for.
      I'm wondering, which recommendation would you give me to make the script 'check' the user's permissions for specific SharePoint Sites. So, if the user doesn't have access right for specific SP sites it would avoid mapping that site and would continue with the next one.
      My problem here is that I want to use the same script for different user with different access rights, and want to avoid mapping sites for users that doesn't have access to those.
      Thank you again!
    • Hi Carlos,
      you could add some code to verify there is no 'access denied' error when the script browses to the sharepoint URLs. 
      another method would be to check for group membership or such. I could probably code that in half a day for you.
    • Thanks for the reply. Yes, I managed to add group membership checking to your script using some of the code from this other script: 
      Still, I'm not an expert so you probably have a better solution. Maybe verifying there is no 'access denied' error would be more efficient.
  • Does it work with Windows 10 AD Joined to 365?
    3 Posts | Last post January 29, 2016
    • Hi Jos
      Would this work automatically with a user signing into their Windows 10 device with their Office 365 credentials? 
    • last time I tested with a Azure Workplace Joined machine (which I assume you mean), was in a preview build. At the time it worked fine :) Let me know if it doesn't and I'll work on that.
    • tested today, worked without any prompts, full SSO.
171 - 180 of 197 Items