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


  • 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 :)
  • 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 :)
141 - 150 of 191 Items