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


  • Slight issue
    5 Posts | Last post October 20, 2016
    • Hi Jos this is a great scrip and it has saved one of my schools thousands of pounds.
      
      They are getting a similar intermittent error occasionally to the post below:
      
      An error occurred while connecting P: to \\tennant-my.sharepoint.com@SSL\DavWWWRoot\personal\a_user_tennant_co_uk\Documents
      Web Client Network: Access Denied. Before opening the file location, you must first add the website to the trusted sites list (It is !) browse to the website and select the option to log in automatically.
      
      In the log I get 
      Zone 0 was not yet set, setting it to 3
      Zone 1 was set to 3, setting it to 3
      Zone 2 was not yet set, setting it to 3
      Zone 3 was not yet set, setting it to 3
      Zone 4 was not yet set, setting it to 3
      current URL: https://login.microsoftonline.com/
      Detected running explorer process
      Login attempt at Office 365 signin page
      Failed to find signin element type 1 on Office 365 login page, trying next method. Error details: You cannot call a method on a null-valued expression.
      Failed to find signin element type 2 on Office 365 login page, trying next method. Error details: You cannot call a method on a null-valued expression.
      Found sign in elements type 3 on Office 365 login page, proceeding
      attempting to trigger a redirect to ADFS using method 1
      waited for more than 10 to get redirected to ADFS, attempting normal signin
      asking user for password
      asking user for password
      asking user for password
      Failed to find the correct controls at https://www.office.com/?trysignin=0 to log in by script, check your browser and proxy settings or check for an update of this script. Property 'value' cannot be found on this object; make sure it exists and is settable.
      autoProtectedMode is set to True, reverting to old settings
      
      Any pointers to fix appreciated.
    • I'd have to see a full recording of the script in debug mode, apparently your user is getting redirected somewhere I've not seen before (https://www.office.com/?trysignin=0)
      
      This could mean you've got something new/different, or something is improperly configured. You can send the recording to josliebennu (put the right characters between sl and nn)
    • Thanks Jos.  I'll get the customer to do a recording and send it over.
      Adrian
    • I have just tested and https://www.office.com/?trysignin=0 takes you to the Office 365 advertising page
      https://www.office.com/?trysignin=1 takes you to login.microsoftonline.com
    • that doesn't explain why they end up at the trysignin url at all...I see you're using v2.33, I'll release v2.47 on my blog in a few hours, it'll be best if you get me a clean log with the issue and a recording from that one :)
  • Access Denied Error when running script
    3 Posts | Last post October 02, 2016
    • Hello,
      
      We used the script successfully until a while ago, when mappings started failing with the errors below. We tried a lot of things, but we cannot fix the problem. Do you have any idea as to what the problem could be?
      
      Mapping target: \\xxxx-my.sharepoint.com@SSL\DavWWWRoot\personal\xxx_xxxx_xxx_xxx\Documents
      failed to contact O: after mapping it to \\xxxxx-my.sharepoint.com@SSL\DavWWWRoot\personal\xxx_xxxx_xxx_xxx\Documents, check if the URL is valid. 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.
      
       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.
      
      Regards,
      
      Stijn
    • Hi Stijn,
      
      please send the full log and script configuration section to josliebennu, put the right characters between sl and nn.
    • Have you try to manual map the drive? Seems like Microsoft have broke mapping personal OneDrive in Windows 10 atleast. A workaround for now seems to be to turning Protection Mode off in registry. Maybe is best to do it temporarily and turn it on after the personal OneDrive has been mapped.
      
      HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\ProtectionMode=0
      
      Regards,
      
      Tobias
  • All libraies under one Drive
    2 Posts | Last post October 01, 2016
    • Hi
      Thanks for your great script, it's a very good job.
      
      We use it for a RDS server farm with more than 600 user. 
      Each user has access to some sites (groups) libraries. it runs correctly but uses one letter per libray. Isn't it possible to put all the libraries under ONE Letter ? this would be a great enhancement. 
      
      Subsidiary question : how can we handle "Shared with me" folders ? Automatically ?
      
      Chris
      
    • Hi Chris,
      
      you could make 1 library with links to the other libraries and map that perhaps? The script doesn't have this feature, nor is it on the roadmap for now.
      
      Shared with my folders are something I haven't looked into yet, onedrive doesn't sync that folder though, and it looks like it is an in-browser query (view) instead of a document library so I don't think that'll work.
  • Will this work?
    2 Posts | Last post September 26, 2016
    • Hi Jos,
      
      Will your script work for our configuration?
      
      We have about 60 users on four 2012 R2 RDS Servers, and have Office 2016 installed (Office 365 Enterprise E3 license). We are duplicating our RDS environment in Azure, and want to find a way to have user's My Docs accessible via OneDrive in the local RDS Servers and the Azure RDS Servers.
      
      Right now, user's My Docs are stored on UPDs. I'm assuming we will need to migrate those to OneDrive and then re-direct My Docs to the mapped drive?
    • that will work :) and you can use o365migrator to migrate upd user data to onedrive for business
  • I don't have any question (yet)
    7 Posts | Last post September 21, 2016
    • I wanted to say just "THANK YOU Jos"
      You saved me
    • Glad to hear :)
    • But now I have a problem :)
      first of all, sorry for my english :(
      I had tested your script before on windwos 10 and test result was success but now I have tested on windows server version, failed.
      when the user logon to windows embedded 8.1 I'm redirecting him to the RDP connection.
      user is using windows server 2012 R2 standard via RDP on windows embedded version. I need the create map folder on rdp session.
      I hope i could explain.
      here you are the error details what I have
      Possible critical error: microsoft office installaion not detected (actually, office 2016 already installed)
      Failed to find signin element type 3 on office 365 login page, attemting to log in anyway, this may fail. Error details: Method invocation failed because [System.__ComObject] does not contain a method named 'IHTMLDocument3_getElementById'.
      and the another message
      Failed to find the correct controls at https://login.microsotonline.com/.... to login by script, check your browser and proxy settings for an update of this script (i can open the microsoft site, I've tested)
      
      Any help with this will be greatly appreciated :)
      script v2.39
      
    • Hi Erkan,
      
      are you blocking Onedrive through a GPO in Office 2016? This could cause those elements to not work.
      
      a workaround is to do a Search & Replace in the Onedrivemapper.ps1 file, replace "IHTMLDocument3_" with "" (in other words, remove IHTMLDocument3_ from the file, everywhere it can be found).
    • Hi Jos,
      
      Thank you for your quick reply
      There is no any restriction or blocking on OneDrive.
      I've changed the all IHTMLDocument3_ records with "" but no success.
      No error, no message, no window, nothing.
      :(
    • So entries now look like this example? $script:ie.document.getElementById() (no quotes!)
      
      Best double check, and then send me the file and logfile to josliebennu (add the right characters between sl and nn)
    • Hi Jos,
      
      Now I have new error
      When I start the script giving an error. 
      in a small window
      cannot find
      ...//domainname.sharepoint.com@ssl/DavWWWRoot.../site/Document
      Make  sure the path or internet address is correct
      
      I had created map folder on different computer.
      Another issue:
      My onedrive storage size is 1TB but it shows me as much as my local HDD
      
      I will send the log file now, thank you for your help
      
      
  • Office 2010 or higher installer
    3 Posts | Last post September 20, 2016
    • Hi, about the Office 2010 or higher installer part, what if I do not have it ?
      We use office on citrix, but I would like to map the drives also locally on the PCs
      By the way, great job, thank you for your awesome script!
    • You could try doing a search+replace in the script for IHTMLDocument3_, replace it with nothing....and pray it works, it works for me on Windows 10 machines.
    • Thank you it's working!
  • Keep login for user
    1 Posts | Last post September 09, 2016
    • We are using this in Citrix as an application to let user run it. But for users, they are keep logging with no luck. For account with admin permission, there is no issue. I am not sure what's the cause of the issue. Do you have any ideas?
  • Failed to find the correct controls
    2 Posts | Last post September 02, 2016
    • Hi
      
      We have been using this great script for a while now and have to say great work! 
      
      This week, we have been getting the following issue when now executing the script:
      
      Failed to find the correct controls at https://portal.office.com/AdminPortal/Home?switchtomoderndefault=true#/homepage to log in by script, check your browser and proxy settings or check for an update of this script (2). Property 'value' cannot be found on this object; make sure it exists and is settable.
      
      We are using v2.37 of the script
      
      Any help with this will be greatly appreciated :)
    • Hi Simon,
      
      If you want to be sure it's the latest version, it's best to check my blog at http://www.lieben.nu, I sometimes forget to also update Technet. 
      
      In addition, you'll find where to send the logs (which I'd need) here: http://www.lieben.nu/liebensraum/contact
  • Error 80080005
    6 Posts | Last post August 26, 2016
    • Hi Jos,
      First of all great work.
      The script works great but for some reason the last few days it is not working anymore. It hangs on this command: 
      $script:ie = new-object -com InternetExplorer.Application
      
      I have search in google for answers but I cannot find any fix.
      Maybe you have an idea or some fix to help me.
      
      Full error:
      new-object : Retrieving the COM class factory for component with CLSID {0002DF01-0000-0000-C000-000000000046} failed du
      e to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILUR
      E)).
      
      
    • Even after a reboot? Sounds like the machine is under such a high load it won't allow the COM object to be started:
      
      https://blogs.msdn.microsoft.com/adioltean/2005/06/24/when-cocreateinstance-returns-0x80080005-co_e_server_exec_failure/
      
      I'll add a 'retry' in the script in v2.38
    • Thanks Jos for your quick response but a restart did not do the trick
    • you can download a beta of v2.38 on my blog to see if a retry does the trick
    • Yes, the same error is still occurring with the beta version.
    • then something is preventing you from starting a com object properly, I can't help you further without debugging at this point
  • Redirect Failing
    2 Posts | Last post August 23, 2016
    • I noticed that it redirects to https://domain-my.sharepoint.com and you are looking for the relevant UPN/Site in the URL, but the URL doesn't contain any of that.  The only thing that shows is https://domain-my.sharepoint.com/Default.aspx.  Its just the MySite page and not the OD4B page.  The log continually shows "Attempting to detect username at https://domain-my.sharepoint.com/Default.aspx, waited for 0 seconds".
    • then either the user does not have a Onedrive license, or you've configured something in O365/SpO that changes the default start page for a user in Sharepoint MySites, or your tenant has been upgraded before mine with a change that break the script, but I strongly suspect that its a customized thing in your SpO.
131 - 140 of 194 Items