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


  • 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.
  • Doc redirection and persistent mappings
    2 Posts | Last post August 22, 2016
    • Hi Jos, what a great script!  I am having a little issue with 2 things...
      
      I get the script to apply about 70% of the time and can't figure out what I'm doing wrong.
      
      Also, the option to set doc redirection for One Drive for Business does not seem to work.  
      
      When the script runs at startup, the drives map for both the SharePoint Directory and the User one drive - but when you logout and back in there is a message from windows stating it could not connect all network drives....not sure why this would be.  
      
      The folder redirect for documents is huge for me but cannot get this to work.  I guess first and foremost, if I enable this option, will it try to use windows sync to snyc the files in case the machine is offline?  if so or if I can create a GPO that will automatically keep those files available offline, I would really like to figure out what i'm doing wrong.
      
      is there anyway you could provide some insight?  2012 r2 domain fully updated (for new environment) with win 10 clients.. 
    • Could you send me some log files of redirection failing?
      
      I've never tried making the mapped drive available offline, interesting idea but it wouldn't surprise me if windows won't allow that.
      
      Josliebennu for the logs, put the right characters between sl and nn
  • Attempting to Detect Username
    1 Posts | Last post August 19, 2016
    • This script has been running fine, but recently stopped working.  Running debug mode shows me that it is landing on https://mydomain-my.sharepoint.com.  There is no /personal/ in the URL so it gets stuck there.  Is this something new that MSFT is doing with the redirect?  Like I said, the script was fine until very recently. 
  • Attempting to detect username
    10 Posts | Last post August 05, 2016
    • On my pc the script runs perfectly. If I am logged into another or someone else tries it with same IE version and safe sites it does not work. The error we get is
      Login attempt at Office 365 signin page
      Found sign in elements type 1 on Office 365 login page, proceeding
      Found sign in elements type 2 on Office 365 login page, proceeding
      Found sign in elements type 3 on Office 365 login page, proceeding
      attempting to trigger a redirect to ADFS using method 1
      login detected, login function succeeded, final url: https://adfs-farm.jefferson.edu/adfs/ls/?client-request-id=cef83900-3fdd-4d78-8a81-a7a8bff692c4&username=jxk195%40jefferson.edu&wa=wsignin1.0&wtrealm=urn%3afederation%3aMicrosoftOnline&wctx=estsredirect%3d2%26estsrequest%3drQIIAbPSySgpKSi20tcvyC8qSczRy81MLsovzk8ryc_LycxL1UvOz9XLL0rPTAGxioS4BBgsf5y7a1_h29W4fMX-b5OOrGJUJmyE_gVGxheMjLeYBP2L0j1TwovdUlNSixJLMvPzHjHxhhanFvnn5VSG5Gen5k1i5svJT8_Miy8uSotPy8kvBwoATShITC6JL8lMzk4t2cWsYm5oYmxunGKma5FibKJrkpZopmuZmJyia25skmqUaGBomGRgdIFF4AcL4yJWoJtPtcYpv7uxz3GNWeuC6-Xvok-x6ieblbqXG4QmGqeHebqnRYYWV2RZOBp7WXqVaDvmVLk5B_qXFlgUhqQYm5rYmlgZHuBkBAA1%26LoginOptions%3d1&popupui=&LoginOptions=1
      Attempting to detect username at https://login.microsoftonline.com/login.srf?wa=wsignin1%2E0&rpsnv=4&ct=1470338726&rver=6%2E1%2E6206%2E0&wp=MBI&wreply=https%3A%2F%2Ftjuv%2Dmy%2Esharepoint%2Ecom%2F%5Fforms%2Fdefault%2Easpx%3Fapr%3D1&lc=1033&id=500046&whr=tjuv%2Eonmicrosoft%2Ecom&client%2Drequest%2Did=1593969d%2D3024%2D3000%2D382e%2Dc3196cca2e90, waited for 0 seconds
      Attempting to detect username at https://login.microsoftonline.com/login.srf?wa=wsignin1%2E0&rpsnv=4&ct=1470338730&rver=6%2E1%2E6206%2E0&wp=MBI&wreply=https%3A%2F%2Ftjuv%2Dmy%2Esharepoint%2Ecom%2F%5Fforms%2Fdefault%2Easpx%3Fapr%3D1&lc=1033&id=500046&whr=tjuv%2Eonmicrosoft%2Ecom&client%2Drequest%2Did=1693969d%2D0026%2D3000%2D382e%2Dcecd2e70a85b, waited for 2 seconds
      
    • hmm, did you modify the 'finalURL's' array and add https://adfs-farm.jefferson.edu? Or is it somehow going to one of these URL's after it fills in the username? (you can see this in debugmode if you set it to $True):
      
      $finalURLs += "https://portal.office.com"
      $finalURLs += "https://outlook.office365.com"
      $finalURLs += "https://outlook.office.com"
      $finalURLs += "https://$($O365CustomerName)-my.sharepoint.com"
      $finalURLs += "https://$($O365CustomerName).sharepoint.com"
      $finalURLs += "https://www.office.com"
    • We modified it. It detects the login for adfs but it never can detect the username on most of the pcs we tried. For some reason those it works on 1 pc.
    • yeah that's because you shouldn't modify it, if the script detects 'it has been signed in' at the ADFS page, then it won't attempt to actually sign into ADFS using the fields for it. The $finalURLs array should only contain landing pages AFTER the user is authenticated and forwarded.
    • I took it out and I still get the error. Even before I added the finalurls.
      Thanks again for your help
      
      Failed to find the correct controls at https://adfs-farm.xxx.edu/adfs/ls/?client-request-id=52fcb979-b351-43bc-bd21-d329e9e5dc91&username=jxk195%40jefferson.edu&wa=wsignin1.0&wtr
      ealm=urn%3afederation%3aMicrosoftOnline&wctx=estsredirect%3d2%26estsrequest%3drQIIAbPSySgpKSi20tcvyC8qSczRy81MLsovzk8ryc_LycxL1UvOz9XLL0rPTAGxioS4BCp3_gkK3LzHea_iZc2XT-9MXMWoTNgI_QuMjC
      8YGW8xCfoXpXumhBe7paakFiWWZObnPWLiDS1OLfLPy6kMyc9OzZvEzJeTn56ZF19clBaflpNfDhQAmlCQmFwSX5KZnJ1asotZJc3U0CDNLMVA19LM0FDXJM3ERDfRKNFINyUtMcXYzMAgycTS7AKLwA8WxkWsQDcfUFP6XPFNxm1ipGZM_JWfaq
      dY9XN9Cn1yLN1yjLKqcjMs8qs8qvI9Cl1Sc8pCA7LTKz2Di_xdI7WDSw29AzxtLa0MD3AyAgA1%26LoginOptions%3d1&popupui=&LoginOptions=1 to log in by script, check your browser and proxy settings or chec
      k for an update of this script (2). Property 'value' cannot be found on this object; make sure it exists and is settable.
    • Does your ADFS automatically sign you in, or show a form to sign in with?
      What is your adfswaittime set to?
      Did you customize ADFS, use skins or anything? These fields need to match if you did:
      $adfsLoginInput        = "userNameInput"           #change to user-signin if using Okta
      $adfsPwdInput          = "passwordInput"           #change to pass-signin if using Okta
      $adfsButton            = "submitButton"            #change to singin-button if using Okta
    • ADFS shows a login form
      adfswaittime is set to default 10(I have tried to increase it but no change)
      I did not customize any skins
      When I put debug mode on. On the failed machines it does redirect to the adfs page but does not automatically login
      On the one that does work it redirects then signs right in. Using the same powershell script on both
      
      
      Thanks again!
    • hmm, likely something wrong with the IE zone adfs is in then on the machines where it fails.
    • If we take our adfs site out of the finalurls. It breaks the script that is working on the only computer it does work on.If we add it back it works fine.
    • well, then I'm out of ideas, I'd need to access a workstation with the issue and reproduce it to help you fix it. As it is likely a configuration issue on your side, I'd have to charge you for my time, you can contact me at josliebennu where you can insert the proper email symbols between sl and nn.
131 - 140 of 191 Items