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


  • Upload Limit 48Mb
    2 Posts | Last post March 05, 2017
    • Jos, this seems to be a default - does that come from SharePoint Online?
      Where can I increase this please?
      
      Greatly appreciate your script... it is awesome!
    • That's a Windows built in default, here's a KB that helps: https://support.microsoft.com/en-us/help/900900/folder-copy-error-message-when-downloading-a-file-that-is-larger-than-50000000-bytes-from-a-web-folder
  • Mapping cannot continue because we could not log in to office365
    1 Posts | Last post March 02, 2017
    • Hi Jos,
      I do the change but still same error:
      ERROR | For some reason we're not at the logon page, even though we tried to browse there, we'll probably fail now but let's try one final time.
      URL: https://eci365-my.sharepoint.com/personal/yweinre_ecitele_com/_layouts/15/onedrive.aspx
      INFO | Detected running explorer process
      INFO | Login attempt at Office 365 signin page
      INFO | Failed to find signin element type 1 on Office 365 login page, trying next method. Error details: Exception from HRESULT: 0x800A01B6
      INFO | Failed to find signin element type 2 on Office 365 login page, trying next method. Error details: Exception from HRESULT: 0x800A01B6
      ERROR | Failed to find signin element type 3 at https://login.microsoftonline.com/login.srf. You may have to upgrade to a later Powershell versio
      n or Install Office. Attempting to log in anyway, this will likely fail. Error details: Exception from HRESULT: 0x800A01B6
      INFO | attempting to trigger a redirect to SSO Provider using method 1
      ERROR | Failed to find the correct controls at https://eci365-my.sharepoint.com/personal/yweinre_ecitele_com/_layouts/15/onedrive.aspx to log in
      by script, check your browser and proxy settings or check for an update of this script. Exception from HRESULT: 0x800A01B6
      INFO | autoProtectedMode is set to True, reverting to old settings
      INFO | Setting zone 0 back to 3
      INFO | Setting zone 1 back to 3
      INFO | Setting zone 2 back to 3
      INFO | Setting zone 3 back to 0
      INFO | Setting zone 4 back to 0
      INFO | Automatically added aadg.windows.net.nsatc.net to intranet sites for this user
      INFO | Automatically added autologon.microsoftazuread-sso.com to intranet sites for this user
      INFO | OnedriveMapper has finished running
      WARNING | restartExplorer is set to False, if you're redirecting My Documents, it won't show until next logon
      Thanks
  • Mapping cannot continue because we could not log in to office365
    2 Posts | Last post March 02, 2017
    • Hi Jos,
      
      we are using a third party samlproxy in our adfs "O365" Relying party trusts.
      we receive error message "Mapping cannot continue because we could not log in to office365"
      on powershell we receive following:
      ERROR | For some reason we're not at the logon page, even though we tried to browse there, we'll probably fail now but let's try one final time. URL: https://login.microsoftonline.com/login.srf
      INFO | Detected running explorer process
      INFO | Login attempt at Office 365 signin page
      ERROR | failed to use Azure AD SSO for Workplace Joined devices
      INFO | Failed to find signin element type 1 on Office 365 login page, trying next method. Error details: Could not complete the operation due to error 80700009.
      INFO | Failed to find signin element type 2 on Office 365 login page, trying next method. Error details: Could not complete the operation due to error 80700009.
      ERROR | Failed to find signin element type 3 at https://login.microsoftonline.com/login.srf. You may have to upgrade to a later Powershell version or Install Office. Attempting to log in anyway, this will likely fail. Error details: Could not complete the operation due to error 80700009.
      INFO | attempting to trigger a redirect to SSO Provider using method 1
      ERROR | Failed to find the correct controls at https://xxx-my.sharepoint.com/personal/yyy_domain_com/_layouts/15/onedrive.aspx to log in by script, check your browser and proxy settings or check for an update of this script. Exception from HRESULT: 0x800A01B6
      INFO | autoProtectedMode is set to True, reverting to old settings
      INFO | Setting zone 0 back to 3
      INFO | Setting zone 1 back to 3
      INFO | Setting zone 2 back to 3
      INFO | Setting zone 3 back to 0
      INFO | Setting zone 4 back to 0
      INFO | Automatically added aadg.windows.net.nsatc.net to intranet sites for this user
      INFO | Automatically added autologon.microsoftazuread-sso.com to intranet sites for this user
      INFO | OnedriveMapper has finished running
       
    • Change this line: 
      
      if($userLookupMode -le 3){
      
      to 
      
      if($userLookupMode -eq 3){
  • One drive mapper will close the internet explorer
    2 Posts | Last post March 01, 2017
    • one drive will close the internet explorer and also will check for the later version
      can we disable these two item?
    • of course, version check is fully optional, closing internet explorer prevents certain issues, but you can try and see if it works for you.
  • Sharepoint http load when finished
    7 Posts | Last post February 28, 2017
    • Hi Jos,
      
      Would it be possible to log into and display Sharepoint through the default web browser as the last action in the script?
    • You could use the urlopenafter parameter, that would use IE though, but the code to use another browser would be super easy to do.
      
      If you use another browser, the script won't have logged in for you.
    • Hi Jos,
      
      Thanks for replying. Unfortunately while I can add the url to our Sharepoint page, it still asks the user to sign in to their account, even in IE.
    • Is the URL you're opening an URL you're mapping? A cookie does have to be present, the script only sets cookies for URLs you map.
      
      Otherwise you might need some custom coding, I know it is theoretically possible to inject cookies into chrome and Firefox too.
    • Hi Jos,
      
      Lets say our domain is company.com and the sharepoint site is companygroup.sharepoint.com.
      
      Please find current settings below:
      
      $configurationID       = "00000000-0000-0000-0000-000000000000" 
      $domain                = "company.com"
      $driveLetter           = "O:"
      $redirectMyDocs        = $False
      $redirectMyDocsName    = "Documents"
      $driveLabel            = "OneDrive"
      $O365CustomerName      = "companygroup"
      $logfile               = ($env:APPDATA + "\OneDriveMapper_$version.log")
      $pwdCache              = ($env:APPDATA + "\OneDriveMapper.tmp")
      $loginCache            = ($env:APPDATA + "\OneDriveMapper.tmp2")
      $dontMapO4B            = $False
      $debugmode             = $False
      $userLookupMode        = 1 
      $AzureAADConnectSSO    = $True
      $lookupUserGroups      = $False
      $forceUserName         = ''
      $forcePassword         = ''
      $restartExplorer       = $False
      $autoProtectedMode     = $True 
      $adfsWaitTime          = 0
      $libraryName           = "Documents"
      $autoKillIE            = $True
      $abortIfNoAdfs         = $False
      $adfsMode              = 1
      $displayErrors         = $True
      $buttonText            = "Login"
      $adfsLoginInput        = "userNameInput"
      $adfsPwdInput          = "passwordInput"
      $adfsButton            = "submitButton"
      $urlOpenAfter          = "https://companygroup.sharepoint.com/SitePages/Home.aspx"
      $showConsoleOutput     = $False
      $showElevatedConsole   = $True
      $sharepointMappings    = @()
      $sharepointMappings    += "https://companygroup.sharepoint.com/SitePages/Home.aspx"
      $showProgressBar       = $True
      $versionCheck          = $True 
      
      I've removed mapping Sharepoint to a drive as we don't want users having explorer access to it. I've added the sharepoint url itself back in to that field (sans a drive letter) just to see if this would make a difference to being automatically signed in IE. Unfortunately that didn't help either.
    • Yeah that wouldn't do much, because the script normally only signs you in to URL's that you defined to map, the URLOpenAfter parameter was added for a consultancy customer who had a GPO that automaticallly opens sharepoint for their employees. When they deployed OnedriveMapper, that GPO had to be disabled, or Onedrivemapper would kill IE. So, what you're asking could be done, but it would require changes to the script.
    • Thanks for the response Jos. If you accept idea suggestions then I would definitely submit this as one but otherwise thanks for this clever script, it's working perfectly in our organisation.
  • Better /persistent:no ?
    2 Posts | Last post February 28, 2017
    • Hi Jos,
      
      I just rolled this out to a few small business customers... I found that since the mapping does not last forever and you need to re-map (I have put into startup), it makes more sense to map persistent:no to avoid having an old (broken) mapping.
      I changed this in the code... and it now works fine, but would it not be better to have as the default or at least have as a parameter?
      
      Regards, Andrew
    • Hi Andrew,
      
      I guess that could be a matter of preference, as the script takes a little while, some would prefer if most of the time it'd still be mapped. But I guess I can add a parameter so it is easier to choose between both options.
  • Failed to Load Signin Element Type 1
    3 Posts | Last post February 23, 2017
    • Hi Jos,
      
      I have an issue at the moment where I receive:
      
      "INFO | Detected running explorer process
      INFO | Login attempt at Office 365 signin page
      INFO | Failed to find signin element type 1 on Office 365 login page, trying next method. Error details: Method invocati
      on failed because [System.__ComObject] does not contain a method named 'IHTMLDocument3_getElementById'.
      INFO | Failed to find signin element type 2 on Office 365 login page, trying next method. Error details: Method invocati
      on failed because [System.__ComObject] does not contain a method named 'IHTMLDocument3_getElementById'."
      
      I'm running this on a server as I need to map our SharePoint library (hosted on Office 365) to the local S Drive. As such, I don't have Office installed. Is there any way of getting this working on a server? 
      
      Regards,
      
      Rob
    • Hi Rob,
      
      you could try replacing all instances of IHTMLDocument3_getElementById with getElementById, the older function that is pre-office.
      
      Or wait till the next version, it'll have a totally IE free auth setting.
    • Thanks, Jos! Very much appreciated :) 
  • Script Speed Question
    4 Posts | Last post February 21, 2017
    • Hi Jos... great script! I have this working 100% in RDS (Active Directory, 2012 R2), Windows 10 AAD, and Amazon Workspace(Windows 7, Workgroup). 
      In Windows 7 on AWS, it takes about 5 minutes to run despite on fast internet. It connects very reliably, but the initial processing seems to take a long time.
      Any ideas on making it quicker?
    • I'd assume the Windows 7 workspace is rebuilt each time? And then I'd further assume its IE that is taking a long time starting up the first time....the log is timestamped and should show where the longest delay is.
      
      I'm working on a version that no longer requires IE and natively authenticates to AzureAD.
    • Jos, not rebuilding... here is the log section that shows the delay: - 3 minutes -
      02/20/2017 06:16:57 | INFO | -----02/20/2017 06:16:57 OneDriveMapper v2.53 - tspvs1 on IP-C0A889D3 starting-----
      02/20/2017 06:16:58 | INFO | Script elevation level: User
      02/20/2017 06:17:02 | INFO | NOTICE: you are running the latest (v2.53) version of OnedriveMapper
      02/20/2017 06:17:02 | INFO | You are running on Windows 6 with IE 11
      02/20/2017 06:20:13 | INFO | 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
    • odd, the script doesn't do anything between those two entries....the last one is just a registry key check, perhaps something is holding/delaying registry access? No clue there, it's definitely not the script itself as there is no 'action' in those 3 minutes that could take a long time.
  • error 224
    3 Posts | Last post February 13, 2017
    • Hi
      Great script and its what we are looking for, but no matter what I do it will not map the drive.
      
      All goes great through in debug but errors at the mapping stage..
      IE settings are all set
      Enable protection mode is off
      Trusted sites are all set (ie *.sharepoint.com etc)
      
      I have tried manually adding trusted sites and via gpo yet same error...
      Any help would be great.
      Thanks
      
    • 02/13/2017 12:10:01 | INFO | NOTICE: pennthorpeschool-my.sharepoint.com found in IE Trusted Sites on user level
      02/13/2017 12:10:01 | INFO | NOTICE: pennthorpeschool.sharepoint.com found in IE Trusted Sites on user level
      02/13/2017 12:10:01 | INFO | NOTICE: *.microsoftonline.com found in IE Trusted Sites on user leve
      
      
      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.
    • I fixed by setting $AzureAADConnectSSO to $True
      
      As we are using AADConnect
      
      
  • 2-factor authentication
    1 Posts | Last post January 21, 2017
    • I haven't been able to map with 2-factor authentication enabled. Here is what I see in the log:
      
      01/20/2017 19:47:58 | ERROR | Failed to find the correct controls at https://login.microsoftonline.com/login.srf?client-request-id=53aec715-a9a9-4dac-813b-1a7e176a3d7c to log in by script, check your browser and proxy settings or check for an update of this script (2). The element cred_keep_me_signed_in_checkbox was not found (2) or had no tagName
      
      This is the 2.53 script. I get the "Approve / Deny" on my device while the script is trying to login. The error comes up as soon as I click Approve. Is there a setting I'm missing?
      
      Also thanks for the great tools - works fine with 2-factor off. Very nice!
      
      
101 - 110 of 194 Items