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,916 times
Add to favorites
Office 365
2/3/2019
E-mail Twitter del.icio.us Digg Facebook
  • Script Doesn't Start Internet Explorer
    4 Posts | Last post December 16, 2016
    • Hi Jos,
      
      I've set the debug mode to true, but it doesn't actually start Internet Explorer and the drives aren't mapped at all. I've fiddled about with the settings, but I get an output like this:
      
      Script elevation level: User
      NOTICE: you are running the latest (v2.49) version of OnedriveMapper
      WARNING: KB2846960 is not installed on this machine, if you're running IE 10 on anything below Windows 10, you may not be able to map your drives until you install KB2846960
      NOTICE: HKLM:\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\Security HKLM only not found in registry, your zone configuration could be set on both levels
      NOTICE: company-my.sharepoint.com found in IE Trusted Sites on user level
      NOTICE: company.sharepoint.com found in IE Trusted Sites on user level
      NOTICE: *.microsoftonline.com found in IE Trusted Sites on user level
      WARNING: HKLM:\Software\Policies\Microsoft\Internet Explorer\Main\DisableFirstRunCustomize not found or not set to 1 registry, if script hangs this may be due to the First Run popup in IE
      userLookupMode is set to 2 -> checking Active Directory email address
      ERROR: WebDav File Locking support is enabled, this could cause files to become locked in your OneDrive or Sharepoint site
      WARNING: Maximum file upload size is set to 48 MB
      Not mapping O4B because dontMapO4B is set to True
      no unmapped or incorrectly mapped drives detected
      OnedriveMapper has finished running
      Restarting Explorer.exe to make the drive(s) visible
      Detected running Explorer processes, attempting to shut them down...
      Stopped process with handle 7596
      
      Any help with this would be greatly appreciated. 
      
      Regards,
      Rob
    • I'm afraid I don't have any suggestions, I'd need to debug....it doesn't seem to log/reach the point where it should start an IE COM object.
    • Thanks, Jos. I realised I had set dontMapO4B to True and so it didn't open up IE at all. 
      I've now set it to False and it launches IE. 
      
      However, I now have another issue where it uses "https://companyname-my.sharepoint.com" as the base URL, whereas it should be using "https://companyname.sharepoint.com". Is there a way to change this? I can see other users have this setup, but I haven't seen a post explaining how they did it. 
      
    • Why is that an issue? Does the user have a license for Onedrive for Business? Otherwise that url won't work, and the script won't do it's job properly.
  • Mapping cannot continue because we could not log in to Office 365
    4 Posts | Last post December 13, 2016
    • Hi Jos,
      
      I have successfully setup the script for 15usrs in my office but one user. I do not think that there is a problem with the computer / IE as I get the same error when I try to log in to another working computer with her profile. This user profile has been created recently and following is the error log. 
      
      KB2846960 detected as installed
      WARNING: HKLM:\Software\Policies\Microsoft\Internet Explorer\Main\DisableFirstRunCustomize not found or not set to 1 registry, if script hangs this may be due to the First Run popup in IE
      userLookupMode is set to 1 -> checking Active Directory UPN
      ERROR: WebDav File Locking support is enabled, this could cause files to become locked in your OneDrive or Sharepoint site
      WARNING: Maximum file upload size is set to 48 MB
      Adding to mapping list: P: (\\***-my.sharepoint.com@SSL\DavWWWRoot\personal\)
      Adding to mapping list: A: (\\***.sharepoint.com@SSL\DavWWWRoot\dev)
      P: is not yet mapped
      A: is not yet mapped
      Base URL: https://***-my.sharepoint.com 
      
      autoKillIE enabled, stopping IE processes
      Stopped process with handle 15116
      Stopped process with handle 12396
      autoProtectedMode is set to True, disabling ProtectedMode temporarily
      Zone 0 was set to 3, setting it to 3
      Zone 1 was set to 3, setting it to 3
      Zone 2 was set to 3, setting it to 3
      Zone 3 was set to 0, setting it to 3
      Zone 4 was set to 0, setting it to 3
      Starting logon process at: https://login.microsoftonline.com/login.srf?msafed=0
      Detected running explorer process
      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 SSO Provider using method 1
      Signin Option persistence selected
      waited for more than 10 to get redirected by SSO provider, attempting normal signin
      Signin Option persistence was already selected
      ...
    • Retrieved user password from cache C:\Users\mspudic\AppData\Roaming\OneDriveMapper.tmp
      We attempted to login without using ADFS, but did not end up at the expected location. Detected url: https://login.microsoftonline.com/login.srf?msafed=0#, expected URL: https://***-my.sharepoint.com
      autoProtectedMode is set to True, reverting to old settings
      Setting zone 0 back to 3
      Setting zone 1 back to 3
      Setting zone 2 back to 3
      Setting zone 3 back to 0
      Setting zone 4 back to 0
      OnedriveMapper has finished running
      WARNING: restartExplorer is set to False, if you're redirecting My Documents, it won't show until next logon
    • Did you try to run it in debug mode, so you can see what goes wrong at the login page?
    • Fixed.. When I debug the code, I realized that the user name has been pointed to the local domain (abc@xyz.local). Thus, the login failed to O365 site. I went in to AD and changed the user login name to their public domain(abc@xyz.com).
      
      Everything worked find with the next login.
      
      Thanks Jos.
  • Can't get Azure AD to work. No registry files found.
    2 Posts | Last post December 12, 2016
    • Hey Jos,
      
      We are trying to setup the scripts to use our Azure AD accounts but none of the 3 registry files exist in your script. We recently had our own AD system before we gave it to Microsoft to host on Azure. Do you know what those registry files refer to and if we may need to be looking somewhere else so we can get it to sign in on it's own based on the User's password?
      
      We have confirmed it is AzureAD and the passwords from AD to Email/Webmail sync fine aka are the same. So it looks like it something to do with:
      ---
      userLookupMode is set to 3, but the registry path HKCU:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WorkplaceJoin\AADNGC does not exist! Using method 2
      userLookupMode is set to 3, but the registry path HKCU:\Software\Classes\Local Settings\Software\Microsoft\SettingSyncHost.exe\WinMSIPC does not exist! Using method 3
      userLookupMode is set to 3, but the registry path HKLM:\SOFTWARE\Microsoft\IdentityStore\Cache\S-1-5-21-3652272553-2793898406-639975886-3624\IdentityCache\S-1-5-21-3652272553-2793898406-63997
      5886-3624 does not exist! All lookup modes exhausted, exiting
      ---
      I did see some of the folder structures like HKLM:\SOFTWARE\Microsoft\IdentityStore\Cache\S-1-5-21-3652272553-2793898406-639975886-3624\ but nothing was any further down then that.
    • Hi William,
      
      interesting, so you're sure you're AzureAD Joined? Not Azure Domain Services joined (or another traditional AD Join form?). 
      
      Perhaps you found a new niche, can you do a search for your user's UPN in the registry under HKLM:\SOFTWARE\Microsoft\IdentityStore and see if you find anything? 
      
      Or throw me an export of the registry if you trust that, josliebennu (put the right chars between sl and nn). We'll probably have to add a new detection method for your user's UPN.
  • 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.
121 - 130 of 197 Items