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
  • How to Disable Security Warning
    5 Posts | Last post June 23, 2016
    • I configured the script to map only a sharepoint drive and disabled the OD4B. I also need it deployed to about 1000 users so i set it as a Logon GPO.
      
      Upon user login it pops up with the message box:
      "Security Warning
      
      Run only scripts that you trust. While scripts from the
      Internet can be useful, this script can potentially harm your computer. Do you want to run
      
      E:\InstallFiles\install Scripts\SharePointServers.ps1?
      
      [D] Do not run  [R] Run once  [S] Suspend [?] Help (default is “D”):"
      
      How do I disable that? I would prefer the user not to have to type in R every time or as little user intervention as possible.
      
      And also is there a way to have the script detect the drive and if it is already setup end the script if not continue?
      
      Thanks for the help
    • Instructions for that can be found on my blog :)
    • Thanks. 
      I saw in the blog that you recommend to run it as a normal script, however when i do so it does not launch the script.
      
      My settings:
      
      Script Name: Powershell.exe
      Parameters: 
      -ExecutionPolicy ByPass -WindowStyle Hidden -File \\contoso.com\SysVol\contoso.com\Policies\{E1CC5F15-DB92-458D-8BAE-34CA11A74612}\User\Scripts\Logon\onedrivemapper.ps1
      
      Works when i apply it from the 'powershell scripts' tab
      
      however does nothing when i apply script using the normal script tab.
      
      any ideas?
      
    • Odd, i've seen this work in countless of setups, there is probably some other conflicting policy or your workstation cannot resolve Powershell.exe. I've only seen that once, the admin had to enter the full path to Powershell.exe instead of just Powershell.exe
      
      Either way, running it from the scripts tab is not really supported and almost never used in general. But if you really want to, you could disable all security and set the execution policy to unrestricted as an alternative. I wouldn't recommend it though.
    • Thanks for your help Jos. I created a new share instead of using the sysvol folder and user server hostname in file path instead of domain name and that resolved my issue. Thanks. Script works great. Awesome!
  • Will not map anymore
    4 Posts | Last post June 23, 2016
    • Recently the script started generating errors and closing Internet Explorer. I can tell you that the noted sites are in trusted sites and added registry entry for  HKCU to add our main site. These are the errors:
      
      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: sequenturllc-my.sharepoint.com found in IE Trusted Sites on user level
      Possible critical error: sequenturllc.sharepoint.com not found in IE Trusted Sites on user or machine level, the script will likely fail
      
      
      We attempted to login without using ADFS, but did not end up at the expected location. Detected url: https://login.microsoftonline.com/login.srf?wa=wsignin1.0&rpsnv=4&ct=1466106126&rver=6.7.6640.0&wp=MCMBI&wreply=https%3a%2f%2fportal.office.com%2flanding.aspx%3ftarget%3d%252fdefault.aspx%253fwa%253dwsignin1.0&lc=1033&id=501392&msafed=0&client-request-id=955b8bb1-c2f4-403c-8932-a4936d69ad7a, expected URL: https://sequenturllc-my.sharepoint.com
      
      I have tried all versions from 2.27 through 2.34, am I missing something. This is on a Windows 10 machine on a domain but others have the problem too. I can map everything manually ok.
    • did you run it in debug mode to see what happens? 
      
    • Yes, Internet Explorer opens but when it tries to login, the browser immediately closes.
      Pertinent log entry is below:
      -----06/22/2016 16:26:46 OneDriveMapper V2.35 - kmann on SQ-E5550-KM starting-----
      Script elevation level: User
      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: sequenturllc-my.sharepoint.com found in IE Trusted Sites on user level
      NOTICE: sequenturllc.sharepoint.com found in IE Trusted Sites on user level
      NOTICE: login.microsoftonline.com found in IE Trusted Sites on user level
      current URL: https://login.microsoftonline.com/
      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 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 10 to get redirected to ADFS, attempting normal signin
      asking user for password
      We attempted to login without using ADFS, but did not end up at the expected location. Detected url: https://login.microsoftonline.com/login.srf?wa=wsignin1.0&rpsnv=4&ct=1466627231&rver=6.7.6640.0&wp=MCMBI&wreply=https%3a%2f%2fportal.office.com%2flanding.aspx%3ftarget%3d%252fdefault.aspx%253fwa%253dwsignin1.0&lc=1033&id=501392&msafed=0&client-request-id=32bb6b0b-a019-40cb-904c-0c26f257ef77, expected URL: https://sequenturllc-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 3
      Setting zone 4 back to 3
      OnedriveMapper has finished running
      
    • I'm sorry but this really isn't enough information to help you any further, and I currently don't have the time to do a free remote session with you to manually debug what exactly fails. If an older version worked for you, then by all means :)
  • Webdav performance whilst uploading files
    5 Posts | Last post June 22, 2016
    • Hi,
      Love the script, works as a charm after initial configuration. 
      However, using file-explorer, downloading files from the Onedrive mapping (O:\ in our case) works great, but uploading files larger than a few MB invokes a delay. The upload pauses for a while and then continues to finish. I've been searching all day but am unable to fix this.
      Larger files (say 100MB+) invoke an error stating that it passes maximun file size. 
      
      Do you know of settings, tweaks, tips or tricks to improve the upload performance for the file-explorer whilst uploading files?
      
      And is there a filesize limit somewhere??
    • thanks :)
      
      For speed tweaks, check autoconfig of IE (proxy settings).
      For the file size limit: https://support.microsoft.com/en-us/kb/2668751
    • this registry key also has a number of tweaks: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRxDAV
    • Thanks Jos, the IE proxy settings are set as you recommended. Ill go check the MRxDAV register tweaks.
    • One thing we keep seeing is that the file transfers very quickly (200MB/s) but after transfer goes in some kind of wait for a few minutes before finishing the transfer.
  • How do view the log?
    2 Posts | Last post June 16, 2016
    • Im getting some errors but dont know how to view the log.
    • it is in the appdata directory, just type %appdata% in explorer
  • always mapping to logged in user
    2 Posts | Last post May 11, 2016
    • For onedrive mapping I had a co-worker insert their username and pwd into the custom login pop-ups.  Authentication worked but the mapped drives are not for that user, but still pointing to my own?  What did that other users authentication accomplish?  Can I make the script use the login credentials instead of that other location it's pulling from?
      
      Thanks,
    • If you are using ADFS, this is simply what ADFS does: it logs you in with the user currently logged into your workstation (SSO)
  • Running at startup Windows 10
    3 Posts | Last post May 11, 2016
    • Hi, I am trying to get this to run at start up via a scheduled task deployed by GP on Windows 10 machines. The task is being deployed okay, but for some reason is not running at login as intended. I can run the scheduled task manually and it works fine. Has anyone else had success with deploying this on Windows 10? it works prefect with Windows 7 via GP. 
      
      Any ideas?
      Thanks
      
    • Only way I got it to work is to run interactively as the user.
    • This is covered in the FAQ on my blog, didn't have room/time to maintain another FAQ here sorry :)
  • Mapped Drive space isn't accurate, Prompts, Sharepoint.
    2 Posts | Last post May 10, 2016
    • Hi, 
      I've had some success using this tool, but have a few questions that I hope you can assist.  
      
      my environment - Win7, ADFS, onedrive, O365, Sharepoint
      
      1. Once the drive is mapped it's not showing the space accurately, it's mirroring the space details of the C:\ Drive.  Anyway to match the 1TB or whatever the user has? 
      
      2. I feel like I am getting one too many prompts.  For example, I am prompted One time from the custom form for a username(O365 UPN doesn't match computer login) then a second custom form for pwd.  While this is happening I also get a security prompt from IE asking for the same details.  Is this for the same thing?  Can one do the job of the other?  
      
      3. The sharepoint documents mapping.  My library has a space in the name, what should my syntax look like?  
      Here's my entry. 
      
      $showConsoleOutput     = $True                     #Set this to $False to hide console output
      $showElevatedConsole   = $True
      $sharepointMappings    = @()
      $sharepointMappings    += "https://ogd.sharepoint.com/site1/documentsLibrary,ExampleLabel,Y:"
      $sharepointMappings    += "https://bw.sharepoint.com/brytest/Shared Documents,brylabel,U:"
       
      
      
      
    • 1: this is by design by Microsoft for webdav drives
      2: that IE prompt is probably ADFS, the script only supports SSO OR Forms-based authentication modes in ADFS, the IE popup can't easily be accessed via script. 
      3: either Shared%20%20Documents or Shared%20Documents should work
  • OneDrive for Business Only?
    2 Posts | Last post May 10, 2016
    • Awesome work, thanks! Do you know if this will work for non-Business OneDrive, like through an outlook.com address?
      
      Josh
    • I'm afraid not
  • Default page in O365
    2 Posts | Last post May 04, 2016
    • Hi,
      
      When I run the script everything work well for a user but it's not working for others. I found a way to fix the problem but I would like to have a solution that does not require user interaction.
      
      When I run the script and the user default login page in Office 365 is OneDrive everything work fine. The users have the default login page with link to all the applications (Word, Excel, etc.) and the script dont seem's able to redirect to OneDrive from here.
      
      The default login page is https://www.office.com/1?auth=2&home=1&from=PortalLanding&client-request-id=f966e422-58be-47ab-bf6c-d5d0b4ba5784
      
      The working login page (oneDrive) is https://csduroy-my.sharepoint.com/personal/user_name_csduroy_qc_ca/_layouts/15/onedrive.aspx
      
      I dont want to change the login page (as the users can choose any apps from there and download Office) but I would love this script to work.
      
      Any tips?
      
    • ah, sure, that's easy to fix, I haven't seen that domain being used as a start page before, just add this line at line 153 of the script:
      
      $finalURLs += "https://www.office.com"
      
      Enjoy ;)
  • Error while mapping One Drive to a network drive
    6 Posts | Last post April 28, 2016
    • Hi
      
          I am using the script to map my One Drive for Business on my desktop. The scripts ends without error. But the drives are not mapped. I had look into the log file and it shows this. Please let me know how to solve it
      
      lookupUPNbySAM is set to True -> Using UPNlookup by SAMAccountName feature
      Script elevation level: Administrator
      Possible critical error: Microsoft Office installation not detected, script may fail
      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
      Possible critical error: onevmw.sharepoint.com not found in IE Trusted Sites on user or machine level, the script will likely fail
      Possible critical error: onevmw-my.sharepoint.com not found in IE Trusted Sites on user or machine level, the script will likely fail
      WARNING: WebDav File Locking support is enabled, this could cause files to become locked in your OneDrive
      Adding to mapping list: X: (\\onevmw-my.sharepoint.com@SSL\DavWWWRoot\personal\)
      X: is not yet mapped
      Base URL: https://onevmw-my.sharepoint.com 
      
      autoKillIE enabled, stopping IE processes
      Stopped process with handle 17716
      Stopped process with handle 2016
      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 3, setting it to 3
      Zone 4 was set to 3, setting it to 3
      current URL: https://login.microsoftonline.com/
      Detected running explorer process
      Login attempt at Office 365 signin page
      Found sign in elements type 2 on Office 365 login page, proceeding
      attempting to trigger a redirect to ADFS
      login detected, login function succeeded, final url: https://portal.office.com/Home
      Failed to get the username from the URL for 30 seconds, aborting
      autoProtectedMode is set to True, reverting to old settings
    • You can find my reply at my blog, as you asked there as well (thanks!) :)
      
      I've also uploaded a slightly modified v2.28 which logs more info when it can't find the username.
    • I have tried using v2.29 and still the sam error. Attaching the error log below
      -----04/28/2016 12:31:33 OneDriveMapper V2.29 - graja on 1CLOUD-120 Session log-----
      lookupUPNbySAM is set to True -> Using UPNlookup by SAMAccountName feature
      Script elevation level: Administrator
      Possible critical error: Microsoft Office installation not detected, script may fail
      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: onevmw-my.sharepoint.com found in IE Trusted Sites on user level
      Possible critical error: onevmw.sharepoint.com not found in IE Trusted Sites on user or machine level, the script will likely fail
      WARNING: WebDav File Locking support is enabled, this could cause files to become locked in your OneDrive
      Adding to mapping list: X: (\\onevmw-my.sharepoint.com@SSL\DavWWWRoot\personal\)
      X: is not yet mapped
      Base URL: https://onevmw-my.sharepoint.com 
      autoKillIE enabled, stopping IE processes
      Stopped process with handle 8196
      Stopped process with handle 10700
      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 3, setting it to 3
      Zone 4 was set to 3, setting it to 3
      current URL: https://login.microsoftonline.com/
      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 ADFS using method 1
      login detected, login function succeeded, final url: https://portal.office.com/Home
      Attempting to retrieve the username by browsing to https://onevmw-my.sharepoint.com...
      Failed to get the username from the URL for 30 seconds while at https://onevmw-my.share
    • the final part of the log is important, I can't help you if you only post a part of it.
    • Please find the last part of the log
      
      Failed to get the username from the URL for 30 seconds while at https://onevmw-my.sharepoint.com/_layouts/15/start.aspx#/SitePages/Home.aspx, aborting
      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 3
      Setting zone 4 back to 3
      OnedriveMapper has finished running
    • looks like you're redirected to a custom page, instead of the normal Onedrive page. Browsing to https://tenant-my.sharepoint.com usually redirects to Onedrive for Business for that user. 
      
      I'm afraid the script can't be built to handle unexpected situations like that unless I have access to such environments. You can email me at josliebennu (put the right characters between sl and nn) if you want to hire me to customize it for your specific implementation.
151 - 160 of 197 Items