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
76,905 times
Add to favorites
Office 365
E-mail Twitter Digg Facebook
  • Map OD4B to a different user
    2 Posts | Last post May 22, 2017
    • AWESOME script - thank you.  As an Admin, when user's leave our consulting company (on a regular basis, they come and go), we are always having to check whether the user had content in their OD4B or not and if so, we have to migrate it off to archival storage.
      What would be a cool feature to add to this script is the ability to map a drive letter to a different user's OD4B (we already have admin rights to all OD4B).  If your script did that, then we could add in our own command-line functionality to your script so that our off-boarding script could pipe the user info to your script, your script could map to a users' OD4B and then the off-boarding script could check whether any files existed.  When we off-board (weekly), we loop through an array of user's to process (one at a time) to check mailbox forwarding, etc. and if yours mapped OD4B, ours could check if the user has any files on their OD4B and we would know whether they needed to be archived.  Checking individual users (one at a time) is a pain and the MS reports are inaccurate (and so are several data governance tools) when it comes to file count.
    • You're always free to send an email to josliebennu :) put the right characters between sl and nn
  • some questions
    8 Posts | Last post May 19, 2017
    • Hello and sorry for my English
      I try the script, it is OK, OneDrive is mapped.
      but i dont understand some things :
      1) i have this warning : Maximum file upload size is set to 48 MB
      What does it mean, i can change 48MB ?
      2)in comurter, i see the map but with 111Go of disk space. In O365, i have more space than that. Why the map display this space ?
      3)the map is Ok, but i have this error :
      "ERROR | ERROR: WebDav File Locking support is enabled, this could cause files to become locked in your OneDrive or Sharepoint site"
      what does it mean ?
      Thanks a lot
    • please see the FAQ on my blog :)
    • Ok thanks :
    • ok i found the answers !
      but one thing. I set OneDrive map on U:
      I'd like to add to the script :
      if map U: already exist not execute the script (exit)
      If map U: not exist execute the script
      For the moment if the U: map exist, the scrit replace the map to new destination
    • That feature already exists, the script only replaces the mapping if you change the destination and it checks for persistence ofc.
    • thank a lot
      i 'd like the script do not change the map is U: exist even if the destination is not the same.
      and why in the script you do not change directly the registry for webdav locking ?
    • Because webdav locking is under HKLM, and machine based registry keys require elevation (admin permissions) to change. It is assumed the script runs as a normal user. The MSI version does change this.
    • ok,
      so if i want the script not change the destination is the drive U: is already mapped, i have change this function, i think :
      function checkIfLetterIsMapped()
      i want the script just look if U: is mapped : if not --> map OneDrive, if U: exist --> not map to new destination and exit
  • Map Drive to External Tenant (Shared Repository)
    3 Posts | Last post May 17, 2017
    • It is possible to map a drive to a SharePoint online document library that has been shared to you as an external user with this script?
      Thank you,
    • In theory that should work, but I haven't tested that, nice one :)
    • It does work, I was doing some testing with it.  But it will not work if you want to map drives to your tenant as well.  I was hoping to map it out like the following.
      1. Map the user OneDrive (from own tenant)
      2. Map SharePoint document repository (from own tenant)
      3. Map additional SharePoint document repository (from shared tenant)
      I believe it fails on the third mapping because the script logs into the first specified tenant (your own) and doesn't log into the shared tenant.
      Does the script have the ability to call another script upon completion?  Similar to the function of opening a webpage upon completion.
  • How to
    1 Posts | Last post May 10, 2017
    • I am unable to get script to work.  I am trying to map a O drive that maps to the users Online OneDrive account for the user that logs in to the computer.
  • Invalid URI
    4 Posts | Last post May 01, 2017
    • Hi, I've used your script before with Office 365 and it's always worked great. However, I'm having an issue using it with someone who uses Office 365 purchased through GoDaddy. 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'.
      At C:\Users\User\Desktop\XXXXXX\OneDriveMapper_v3.07.ps1:1775 char:16
      Exception calling "Create" with "1" argument(s): "Invalid URI: The format of the URI could not be 
      Any ideas what I'm doing wrong? I know one thing that is different is their O365 customer name is different from their domain name, but I've set $domain and $O365CustomerName accordingly. Using user lookup mode 4.
      Thanks in advance
    • Hmm, interesting, this is the part where it looks for an ADFS login form. Does your adfs login page contain this? <form method="post" id="loginForm" autocomplete="off" novalidate="novalidate" onKeyPress="if (event && event.keyCode == 13) Login.submitLoginRequest();" action="/
      If not, you may have to adjust that piece of code. I should make that a bit more resilient too, thanks for the reminder ;)
    • I'm not entirely sure, but I don't see that code. If I switch the auth method to ie, it says " Failed to find the correct controls at  to log in by script, check your browser and proxy se
      ttings or check for an update of this script (2). The element cred_keep_me_signed_in_checkbox was not found (2) or had no tagName" 
      So I assume it doesn't.
    • hmm, looks like godaddy is doing their own SSO there....I haven't seen that before and don't have access to a test environment....and without that, I won't be able to adjust the script
  • save documents on X;drive
    1 Posts | Last post April 27, 2017
    • Hello!
      We have deployed your scripts and The students cant save their document. They are asked for log in and after they write password, suddenly the save button is been disable.
      Any hints?
  • Map SharePoint online only
    2 Posts | Last post April 27, 2017
    • Hi Jos,
      First of all thanks for this script. works great!
      We want to use your script to map the SharePoint Online to a drive letter in our Windows 7 PC. We only want to map SharePoint Online; OneDrive is not require to map. Could you please kindly advise which parameters should I set? Thanks in advance.
    • If you want the script to ignore Onedrive set $dontMapO4B to $True
      if you want SharePoint to not be AD group specific set $lookupUserGroups to $False, other wise set to true comment the FIRST "$sharepointMappings    += " with a # and scroll down to edit with your company information
      if($lookupUserGroups -and $configurationID -eq "00000000-0000-0000-0000-000000000000"){
              $groups = ([ADSISEARCHER]"samaccountname=$($env:USERNAME)").Findone().Properties.memberof -replace '^CN=([^,]+).+$','$1'
              log -text "cached user group membership because lookupUserGroups was set to True"
                  $group = $groups -contains "RIO_IT_LG_M"
                     ###REMEMBER, THE BELOW LINE SHOULD CONTAIN 2 COMMA's to distinguish between URL, LABEL and DRIVELETTER
                     #$sharepointMappings += ",West District,Y:" # Exemplo
  • Attempting to detect username
    2 Posts | Last post April 24, 2017
    • I am having an issue. This script works great for almost everyone in our office. However there a few users where it fails on attempting to detect username, it prompts for their O365 passwords a few times, then fails after trying many attempts. I think all the users are setup the same, the only difference is they are newer employees as of this month. They all have access to our Sharepoint site. I am at a loss on where to look for a difference. They all have E3 licenses and mailboxes in O365. Same access rights in Sharepoint (they can create documents, etc.) I saw an earlier post it may have to do with their URl being different for Sharepoint, but it looks the same. Any advice on where to look on this? 
    • It could be that the script is failing to automatically provision their Onedrive for Business....I can't say for sure without the full log, but you could verify by trying this on a new user, if it fails, log in as that user and browse to onedrive, then try again.
  • Cannot map folders with space in the name
    1 Posts | Last post April 19, 2017
    • Hi!
      First of all, thanks for the script, it's really great!
      Second I'm having a problem trying to map $sharepointMappings += " Documents/,DepTecnico,Y:", already tryed $sharepointMappings += ",DepTecnico,Y:" and $sharepointMappings += "^%20Documents/,DepTecnico,Y:" but it doesn't works.
      I can map a drive just fine using: $sharepointMappings += ",DepTecnico,Y:"
  • Folder permissions
    3 Posts | Last post April 18, 2017
    • Hi jos,
      Firstly thank you for this, as it is exactly what my customers wanted!
      Now to the question, am I missing something or doing wrong as I'm mapping the drive through GPO and everything is fine, drive maps etc, yet users without permissions can delete "root" folders to which they dont have actual permissions?
    has many folders and many folders under them, I have added only read rights to sharepoint users and when mapped they can delete all of them as they wish, is there a solution I am missing?
      Thank you in advance,
    • Are you sure those rights aren't being inherited somehow? Or perhaps not mapping the root could also be helpful.
      If you are 100% sure those rights should not be there, then this is a very serious security breach in Sharepoint Online and I urge you to submit a support request with Microsoft, as this should absolutely not be possible. 
    • Hey, 
      apparently Microsoft has pushed out some updates which basicly screwed up all of my previous settings aka. disabling inheritance etc. so now users had Modify rights to the "root"
      After fixing these I tried with user rights and no, I cannot delete the "root" folder, but instead it will continue to delete everything under the root folder to which the user has Modify rights, no errors pop up. I was expecting an error directly when trying to delete a folder to which I dont have rights, but no. So this is a microsoft / sharepoint "problem"
      Thanks for your reply,
81 - 90 of 197 Items