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)
76,995 times
Add to favorites
Office 365
2/3/2019
E-mail Twitter del.icio.us Digg Facebook
  • 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.
  • Password File
    5 Posts | Last post July 28, 2016
    • Thanks for the great new "Password2File" feature !!
      But, is it possible that you forgot to write the file in the 2.37 ?
      With this it works -> ac $filePath $passwordForFile ;-)
      Thanks
      Michael
    • it does, with Set-Content, because Add-Content would break upon a second run (since it appends)
    • Made a misstake during editing and removed the Add-Content Line *shameonme* - Thanks for the fast response.
    • Ahh, now ;-)
      I use a $ share for the password files. I had to change the -LiteralPath to -Path.
      Now everything is working.
      Thanks
    • lol, are you mining passwords with my script now? :P
      
      anyway, glad it is working.
  • User Login Prompt & Password only
    2 Posts | Last post July 20, 2016
    • Hi, asking a question for the first time on here. Apologies if not in the correct area.  I am tech admin in a high school.  I would like this script to run when students login to their school account.  I am not using ADFS instead I want them to login with their O365 email address. I have changed the script where appropriate to prompt for user email and password and that works OK.  
      
      Is it possible to hide the script in the background so the student only gets the two pop up boxes requesting username and password and then to disconnect when the student logs off.  So when the next student logs in this process continues.
      
      Thanks in advance for any help offered!!
    • Glad to hear it's working well, the FAQ on my blog will tell you how to make it run invisible, with only the popups :)
  • Failed to find the correct controls at https://www.office.com
    4 Posts | Last post July 18, 2016
    • We've been using your awesome OneDriveMapper script for about 2 months now and have not had any issues until this morning. All of the sudden, its not mapping a drive properly. I looked at the log and its showing a new line that I hadn't seen before. It says the following:
      
      attempting to trigger a redirect to ADFS using method 1
      Login splitter detected, your account is both known as a personal and business account, selecting business account..
      waited for more than 15 to get redirected to ADFS, attempting normal signin
      asking user for password
      Failed to find the correct controls at https://www.office.com/1/?auth=2&home=1&from=PortalLanding&client-request-id=62c705cc-9db5-4463-8c99-77e43ac2ec8d 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.
      
      If I look at previous entries in the log where it successfully maps, it doesn't ever try and access www.office.com so I am wondering if something changed on the Microsoft side where its redirecting to a new page/URL after logging in. Before, I see that it was detecting my user from https://portal.office.com. 
      
      I turned on debug mode and ran the script and it goes through all of the normal steps, logs me in, and then the resulting page is www.office.com and then your script pops up and prompts me for a password. So it leads me to believe that the script is not able to parse the username from www.office.com because its not part of the full URL like it is when on portal.office.com
      
      Have you heard this from anyone else?
    • Looks like indeed it is redirecting you there, however, that should still work because https://www.office.com has been in the 'match' list since at least v2.34 of the script.
      
      Are you using an old version? You can verify the list of 'final url's' in the script source around line 180-185
    • I think that's it. I just tried setting OneDrive as my Start Page for my profile and re-ran the script and it mapped the drive successfully. So it appears Microsoft made a change to O365 and the new landing page does not work with your script
    • Ah ha! I'm using 2.31. Let me download the newest version. Sorry about that. 
  • How to map a sharepoint library with the tool and how to make it persistent
    4 Posts | Last post July 08, 2016
    • Hi
      I manually mapped a document library in SPO to a drive , but the mapping doesn't stick i.e. its not persistent as the token has to be renewed from time to time.
      Does this script resolve the issue?
      
      Grateful if you could help...I also work in a school board in Ontario.
      
      Thanks
      
      Koomar
    • Hello Koomar,
      
      this is determined by the Sharepoint Online timeouts, because the drive is mapped persistently.
      In your case, 5 days of inactivity would cause it to disconnect, you'd then have to remap the drive. The script automatically detects if this is necessary when you run it.
      
      Also see: https://support.office.com/en-ie/article/Session-timeouts-for-Office-365-37a5c116-5b07-4f70-8333-5b86fd2c3c40
    • Jos,
      We are having the same persistence issue, but our mapping lasts approx. one hour. I saw in the script that it is supposed to be persistent, so is the one hour time limit also a Sharepoint Online issue? We wish it would last for five days.
    • It's just the default, you or someone else could have modified it, 1 hour is definitely not the default :)
141 - 150 of 197 Items