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
(112)
65,109 times
Add to favorites
Office 365
2/3/2019
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • v3.13 ADFS, Workgroup computer
    3 Posts | Last post January 26, 2018
    • Hi guys,
      
      I'm trying to use onedrivemapper on a workgroup computer and I'm getting (401) every time.
      This doesn't happen on domain joined PCs.
      Is there any way to use workgroup PCs with ADFS login?
      
      Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (401) Unauthorized."
      At C:\Users\Administrator\Desktop\onedrive-adfs.ps1:364 char:13
    • I've unchecked "Windows Authentication" under global authentication policy - primary authentication and everything is working just fine. Thank you Jos, you're the greatest hero known to technet community!!
      
      Regards,
      Marko
    • thanks! :)
  • Trusted Sites Error
    3 Posts | Last post January 05, 2018
    • I'm using 3.12 and getting this error, even though trusted sites is populated:
      
      (replaced domain with with mydomain for PII concerns)
      
      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
      ERROR | failed to contact X: after mapping it to \\mydomain-my.sharepoint.com@SSL\DavWWWRoot\personal\s_kelly4_snhu_edu\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.
    • I am getting the same error with 3.13. Were you able to fix it?
    • I found if I login to office365 first then it works.
  • Unable to run it via scheduled task or logon script for non-admins
    3 Posts | Last post December 19, 2017
    • SO... if I'm a local admin whether I kick of the script via scheduled task at logon or via GPO, it works just fine. If I'm non-admin it doesn't map any drives, however, if I run it manually (or interactively as scheduled task) it works fine. Any ideas?
      Thank you
    • Probably a UAC setting, what does the log say? what happens if you just restart explorer.exe?
    • Jos, the log did not say anything, it actually says that it mapped the drive successfully. The explorer gets restarted by your script.
      When I disabled UAC, it mapped fine and I was able to see it, now, just need to figure out how to make it work with UAC turned on :-)
      THank you
  • Version 3.13
    3 Posts | Last post December 08, 2017
    • Hi Jos
      
      I think I have the same issue as Kami2082.
      It appears the Microsoft "new sign in experience" has killed the script from working.
      It's been working for months otherwise.
      
      Is V 3.13 the fix for this and if so could you please send me a link
      
      cheers
    • Hi Jos
      
      OK v3.10 is 3.13 
      Also I can report, that if you do not choose to sign in with the new Microsoft user experience the script still works. It's only an issue if you choos
      
       
    • Hi Jos
      
      V3.11 definately works for me !
      
      Your script rocks ! 
  • No longer works
    3 Posts | Last post December 02, 2017
    • 3.12 worked for few days, now gives:
      Unable to find user realm due to Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (400) Bad Request."
    • And again, update to 3.13 made it work!
      Thank you Jos
    • hi,
      I have the same issue. From where I can download version 3.13?
  • Please help.
    1 Posts | Last post November 30, 2017
    • Could you please help me? I downloaded your script and attempted to run it after I set all of the variables such as drive letter, customer tenant name etc, but every time I attempt to run it, it never prompts me for username and password, but rather just fails with an error message of Mapping can not continue because we could not log into office 365. It finds my UPN correctly, and even lists it in the powershell using user@domain.com for login etc, however, never prompts me for a password. what am I doing wrong?
      
  • v2.22 and v3.10 not working
    2 Posts | Last post November 21, 2017
    • We don't have ADFS, before using v2.22 working very well over one year. Since last Friday, suddenly don't work, no login windows popup. Does Microsoft OneDrive change something in their backend?
      11/17/2017 16:08:27 | ERROR | ERROR: WebDav File Locking support is enabled, this could cause files to become locked in your OneDrive or Sharepoint site
      11/17/2017 16:08:27 | WARNING | Maximum file upload size is set to 48 MB
      11/17/2017 16:08:27 | INFO | Adding to mapping list: K: (\\domain-my.sharepoint.com@SSL\DavWWWRoot\personal\)
      11/17/2017 16:08:27 | INFO | K: is not yet mapped
      11/17/2017 16:08:27 | INFO | Base URL: https://domain-my.sharepoint.com/_layouts/15/MySite.aspx?MySiteRedirect=AllDocuments 
      11/17/2017 16:08:36 | ERROR | Failed to find signin element type 3 at https://login.microsoftonline.com/login.srf?msafed=0. You may have to upgrade to a later Powershell version or Install Office. Attempting to log in anyway, this will likely fail. Error details: The element cred_keep_me_signed_in_checkbox was not found (2) or had no tagName
      11/17/2017 16:08:36 | INFO | Will use maverick.luk@domain.com as login
      11/17/2017 16:08:36 | INFO | attempting to trigger a redirect to SSO Provider using method 1
      11/17/2017 16:08:36 | ERROR | Failed to find the correct controls at https://login.microsoftonline.com/login.srf?msafed=0 to log in by script, check your browser and proxy settings or check for an update of this script. The element cred_keep_me_signed_in_checkbox was not found (2) or had no tagName
      11/17/2017 16:08:36 | ERROR | fallback mode is enabled, and login failed. Attempting native auth mode...
    • Used v3.12 some users work fine. But Some users fail mount one drive.
      Log:
      11/21/2017 15:34:31 | WARNING | no KMSI prompt even though we expected one
      I guess it is due to can’t Keep Me Sign In. Microsoft changed to new sign in method. Problem users login in browser, no KMSI windows popup.
      Do you know how to fix it?
  • Works when it wants
    4 Posts | Last post November 17, 2017
    • Worked for weeks, now I get:
      INFO | Failed to find signin element type new method on Office 365 login page, trying next method. Error details: The element uxOptOutLink was not found (2) or had no tagName
      
      INFO | attempting to trigger a redirect to SSO Provider using method 1
      
      INFO | waited for more than 10 to get redirected by SSO provider, attempting normal signin
      
      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 \\.......
    • I just started getting this today as well. More so the "Failed to find signin element..." and "Failed to find the correct controls at "https:\\login.microsoftonline.com/login.srf?msafed=0". I also noticed that we started to default to the "new sign-in experience" today. I'm thinking that maybe that has something to do with it? If I come across anything concrete, I will update here.
    • New version (3.12) worked for me: https://gitlab.com/Lieben/OnedriveMapper_V3/tree/master
      
      Even though some of the stuff says 3.11, the actual script file is 3.12.
    • Yes, 3.12 was the answer!
  • Excellent script!
    4 Posts | Last post November 17, 2017
    • This works very well for us, thanks alot!
      We do have a minor issue in our published-application Citrix environment though. If users start the "My documents" published application before anything else, the logonscript (Onedrivemapper) maps Onedrive a few seconds after Explorer has started. The result is that the drive is mapped, but the users do not see it unless they refresh the window by clicking F5.
      If we use RestartExplorer=$true, the explorer window is terminated, but never shows up again. I'm guessing this is because it is a published application.
      
      What would be good, is if the script did a programmatic refresh of Explorer instead of kill and restart. Does anyone have any ideas?
    • Hi Ola,
      
      You mentioned that you implemented this in your Citrix environment. We also have a Citrix environment and want to start using OneDrive for Business. I just wanted to to know how you're pushing the script out i.e. group policy or Citrix group policy and does it ask for credentials or does it automatically sign them in? 
      
      Thanks for any help on this. 
    • Hello. We have a user-GPO that starts the script on Logon for every user. In addition we have some Webdav Webclient registry-settings as a Machine-GPO to increase filesizes, transfersettings and such.
      In our environment it's 100% silent mapping, no input for user.
      The only thing is that the script is slower than Explorer.exe, so the user don't see the drive unless he/she hits F5.
    • If you don't see the drive until you hit F5, I think there's a setting\variable in the script to change to fix that.
  • Error running version 3.11
    1 Posts | Last post November 02, 2017
    • ERROR | ERROR: WebDav File Locking support is enabled, this could cause files to become locked in your OneDrive or Sharepoint
       site
      
      Method invocation failed because [System.Int32] does not contain a method named 'IndexOf'.
      At C:\temp\OneDriveMapper.ps1:1856 char:16
      +             if($nextURL.IndexOf("https:") -eq -1){
      +                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
          + FullyQualifiedErrorId : MethodNotFound
       
      Exception calling "Create" with "1" argument(s): "Invalid URI. The format of the uri could not be determined"
      At C:\temp\OneDriveMapper.ps1:331 char:13
      +             $request = [System.Net.WebRequest]::Create($url)
      +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
          + FullyQualifiedErrorId : UriFormatException
41 - 50 of 191 Items