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


  • NET error when mapping drive
    2 Posts | Last post December 08, 2016
    • Hi. I am trying to run this script in a locked down RDS environment. This is the error I get. Any suggestions?
      ---------------------
      Mapping target: \\xxxxxxxxxxxxxxxxxxxx-my.sharepoint.com@SSL\DavWWWRoot\personal\xxxxxxxxxxxxxxxxxxx_co_nz\Documents
      failed to contact X: after mapping it to \\xxxxxxxxxxxxxxxxxxx-my.sharepoint.com@SSL\DavWWWRoot\personal\xxxxxxxxxxxxxxxxxxx_co_nz\Documents, check if the URL is valid. 
      Error: The term 'NET' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. 
      -------------------
      Any suggestions?
    • You seem to be blocking the NET USE command (an executable that comes natively with windows).
      Most likely a group policy, perhaps applocker or one of these settings:
      https://technet.microsoft.com/en-us/library/cc732613%28v=ws.10%29.aspx?f=255&MSPPError=-2147217396
  • OneDrive performance
    2 Posts | Last post December 02, 2016
    • When using the mapped drive for OneDrive the first time and copied some data to it, it was very slow. It took several times longer than it show have with or bandwidth and other Internet uploads. Is that a usual behavior and did anyone noticed that too?
    • webdav is slow, it's a limitation of the protocol and client, but there are a few ways to tweak it to be faster, some of those are in the faq on my blog, others are easy to google :)
  • mapping fails with Okta ass SSO
    9 Posts | Last post December 01, 2016
    • 
      ADFS Control found, we were redirected to: https://"mycomp".okta.com/login/login.htm?
      ADFS did not automatically sign us on, attempting to enter credentials at https://"mycomp".okta.com/login/login.htm?..... asking user for password
      Failed to find the correct controls at https://"mycomp".okta.com/login/login.htm? .......to log in by script, check your browser and proxy settings or modify this script to match your ADFS form. Error details: You cannot call a method on a null-valued expression.
      
    • Check the inline comments and script configuration, it has specific instructions on Okta
    • Hi Jos,
      
      Thank You I actually made changes before like:
      $adfsLoginInput        = "user-signin"           #change to user-signin if using Okta
      $adfsPwdInput          = "pass-signin"           #change to pass-signin if using Okta
      
      But I had adfs button forgotten to change:
      $adfsButton            = "signin-button"            #change to singin-button if using Okta
      
      Now I get some sort of logon issue after entering the password. 
      
      We attempted to login with ADFS, but did not end up at the expected location. Detected url: https://"mycomp".okta.com/login/do-login, expected URL: https://"mytenant"-my.sharepoint.com .
      
      If you like to see the config and log let me know how I can send it to you.
    • what do you see in debug mode? The logs won't help much as I don't have an Okta instance to test / verify this against, support for Okta is based on a single remote session I once had with a company that needed support for it. Okta should redirect to Office 365 after a succesful signin, if it doesn't, additional changes to the script will be required to make it work.
    • It opens IE goes to the Microsoft Login website with IE, does sort of a log out and then goes to login mask but doesn't enter anything.
    • Sorry but this is a little out of scope, if you want me to log in and check for you, you'll have to contact me directly (josliebennu, but the right characters between sl and nn).
    • Sorry, actually it gets stuck at this stage (at the Microsoft Login page) only when why run the powershell script out of the PowerShell ISE.
      
      When I run the script normally it logs me in etc. but IE has a popup message:
      "This page is accessing information that is not under its control. This poses a security risk,. Do you want to continue?" If I click yes the script continues and maps the OneDrive as network drive. 
      
      Is this maybe related to IE going to the company sharepoint to a page that does not exist?
      It fails to load/find:
      https://"o365tenant".sharepoint.com/site1/documentsLibrary
      \\"o365tenant".sharepoint.com@SSL\DavWWWRoot\site1\documentsLibrary
      
      Do I have to enable "Access data sources across domains" in IE or is there anotehr way to get rid of that message?
      
      
    • That security risk message is not related to the SharePoint mapping, because after removing/disabling the sharepoint mapping I still get that message. I disabled "Access data sources across domains", it was set to prompt. Now it is working.
      
      
    • glad to hear :)
  • Script didnt work from Sunday onwards
    4 Posts | Last post November 22, 2016
    • This script was working fine till last week but from last Sunday onward it didn't work.
      
      I have the same error Enrio02 have "Failed to find the correct controls at https://" . Why this is not working ? Microsoft made any changes in OneDrive mapping URL ?
      
      Thanks
      Aslam
    • are you also using Okta?
    • And if it is an emergency, posting here is not the quickest way to reach me :)
      http://www.lieben.nu/liebensraum/contact/
      
    • For future readers: Aslam was using RMUnify as SSO solution, so the issue had nothing to do with Microsoft and/or OnedriveMapper but requires slight customization.
  • Windows 10 logon script window not hidden
    3 Posts | Last post November 15, 2016
    • First off, thank you for this script, it is a great tool for us to have.
      
      My issue is that our windows 10 workstations have the script window appear at logon even though the hidden setting is set. Is there something I can adjust to make the window hidden for windows 10?
      
      Windows 7 works fine (window is hidden).
    • Hmm, and the two showconsole settings in the script config are disabled? 
      
      I have done this on w10 machines and did not see this behavior....and it is hard to help if i can't replicatie the issue :)
    • Thanks, that was the issue, I missed one of the showconsole settings.
  • problem about additional mapping
    3 Posts | Last post November 11, 2016
    • Hi Jos,
      I have two questions/issues:
      
      The script works perfectly for OneDrive mapping except asking for password firstime login despite it is we are federated ID (ADFS).   This is a minor issue for us. 
      
      The second one: I need to map additional sharepoint.com document library to a drive letter.  So I added this on line 1542.
      
       $desiredMappings += addMapping -driveletter "Z:" -url "\\mycompany.sharepoint.com@SSL\ITShare" -label "ITShare"
      
      It is not working with initial login.  However after I opened an IE and browsed to the folder, "open it in Windows Explorer", it then worked fine mapping the library to Z:.
      
      I confirmed that mycompany.sharepoint.com is already in trusted site list. 
      
      Do I miss anything here? I am thinking 1) protected mode; 2) IE initial start could be the problem.  
      
      Thank you very much for all you help and time.
      Yong
    • Hi Yong,
      
      Map sharepoint libraries using this part of the script:
      $sharepointMappings    += "https://ogd.sharepoint.com/site1/documentsLibrary,ExampleLabel,Y:"
      simply replace that or add copies of that line below it.
      Doing it in the place you're doing it won't work.
      
      As for ADFS, that could have many reasons, easiest is to test it out in debug mode, try the adfs sso test url (idpinitiatedsignon.aspx), make sure the right uid is used and you're not behind a proxy, etc....
    • Thanks Jos. It works for additional mappings now.   I will follow your tips debugging ADFS problems. 
      
      Yong
  • after a time onedrive disk lost connection
    2 Posts | Last post November 02, 2016
    • So when i run the script on mine laptop it works great,
      but after a time the connection is lost and gives me the follow error:
      
      An error occurred while reconnecting O: to \\tenant-my.sharepoint.com@SSL\DavWWWRoot\personal\user_tenant_nl\documents
      Web Client Network Access Denied Before opening files in this location, you  must first add the website to your trusted sites list, browse to the website and select the options to login automaticaly.
      
      the site is trusted but we have single sign on and adfs so the option login automaticaly is not available for us
    • That is why it is a logon script, it needs to be rerun every now and then. You can also place a shortcut to it on your desktop, see the FAQ on my blog.
  • $domain variable
    4 Posts | Last post November 01, 2016
    • Hi Jos,
      Our AD domain name is different from UPN suffix.  What should I assign to $domain? 
      
      Thanks
      Yong
    • you probably won't need to set it if the user's UPN is the correct login, just use userLookupMode = 1 (the default)
    • Thanks Jos.  It prompted me for password.  Is it expected? 
      
      Otherwise, it works like a charm after I entered the password!
      
      Thanks again for sharing it with us. 
    • if you don't have ADFS or AzureAD WP join, then yes that is normal.
  • Update Notifications
    2 Posts | Last post November 01, 2016
    • Hi Jos, is there a way we can get email notifications when you update your script?
    • I don't think Technet has that feature, my blog has an RSS feed you could use, or you could click my twitter link there, i usually post a message when I update it.
  • Inactivity Disconnects Drive
    2 Posts | Last post October 27, 2016
    • Hi Jos, thank you so much for creating this script.
      
      We are using 2.47 have noticed that when a user has not logged in for a few days, the drive becomes disconnected. The script runs again and the user gets their drive back after about 5 minutes.
      
      Is there any way to configure the "timeout" settings so the drive does not get disconnected?
    • That timeout is set in Sharepoint Online: https://support.office.com/en-us/article/Session-timeouts-for-Office-365-37a5c116-5b07-4f70-8333-5b86fd2c3c40
      
      You could schedule the script to run every day through the task scheduler :)
121 - 130 of 194 Items