OneDriveMapper

onedrivemapperOneDriveMapper is a free script you can use as a logon or on demand script to map a OneDrive for Business location and/or Sharepoint locations to driveletters, it has been downloaded over 200,000 times and is also listed on Technet.

It was designed to run in scenario’s where using the Onedrive for Business client is not feasible, such as multi-user environments like Citrix or within a RemoteApp. Syncing in such environments is a bad idea as each user potentially has to re-sync data at each login and can potentially access other user’s data.

What does it do?

  • Runs at logon or on demand (group policy, RES, etc)
  • Maps your OneDrive for Business to a local driveletter
  • No Sync, online WebDav connection
  • Connects seamlessly without user interaction
  • Prompts for user password (only once) if no ADFS used
  • On Demand Provisioning of the OneDrive MySite
  • Detailed and configurable logging
  • Also maps Sharepoint Document libraries directly
  • Can also map based on security groups
  • Sets a customizeable label for the Network drive(s)
  • Can use custom library names
  • Can also run on non domain joined machines or Workplace Joined machines
  • Detects changed user names/url’s automatically
  • Can map drives inside (Azure) RemoteApps
  • Can redirect My Documents to Onedrive for Business
  • SSO for MDM Intune AzureAD W10 devices
  • Can be deployed as logon script through Intune
  • Can easily run from a shortcut as well

Requirements

  • Office 365 licence
  • Permission to map drives
  • Permission to launch powershell scripts

Recommendations

How to install

  1. Download the latest version at GitLab or take a look at OnedriveMapper Cloud
  2. Add https://tenantname-my.sharepoint.com to your Trusted Sites list if mapping to O4B
  3. Add https://tenantname.sharepoint.com to your Trusted Sites list if mapping to Sharepoint Sites, O365 Groups or Microsoft Teams
  4. Add adfs.yourdomain.com to your local intranet sites (both http and https) to get SSO if you’re using ADFS. Make sure that whatever method you use to set this, runs BEFORE the script runs.
  5. Ensure Windows Authentication is enabled in Internet Explorer (this is default) if not using Native Auth
  6. Set $O365CustomerName to your Tenant Name (xxx.onmicrosoft.com)
  7. Set $driveletter to the driveletter you wish to map to OneDrive for Business and are not using the Cloud Edition
  8. Set $userLookupMode to what matches your environment
  9. If you wish to map Sharepoint libraries, change line 114 of the script ($sharepointMappings += XXX) if you’re not using the Cloud Edition
  10. disable file locking
  11. Run it on a representative test machine / user and thoroughly check the log it generates in %APPDATA%
  12. Add the configured script to a Group Policy or deploy as MSI to make it run upon logon for all users, automatically mapping your OneDrive for Business webdav share to a driveletter.

Limitations

  • MFA support is still pending
  • Okta is not supported (until okta helps me out)
  • if you use redirection and restartExplorer true, make sure the script runs when the user is fully logged in, restarting explorer during logon can cause hangs. Best practise: don’t enable it, the redirect will work the next logon for roaming profiles
  • This script does not work Powershell V2 or lower (comes with Windows 7), install V3 or higher

Disclaimer

I’m not a real programmer, this code is meant as a Proof Of Concept. I do not guarantee this product will work in your setup, and I offer no dedicated support, I try to help everyone on a best-effort basis but also have to work for a living. So make sure you test well and understand the code before you use it. Note that although it is unexpected, if Microsoft at some point decides to block WebDav connections to OneDrive for Business, this script may suddenly become obsolete without prior warning. If Microsoft drastically changes login.onmicrosoft.com, the script may also stop working until I can release an update.

Changelog

FAQ

 

 

Leave a Reply

1579 Comments on "OneDriveMapper"

Notify of
avatar
Sort by:   newest | oldest | most voted
trackback

[…] OneDriveMapper […]

Chris L-M
Guest
Hi Jos, Awesome script, thanks for making it. I wanted to inform you of issues we have been having with “ie” mode for the last couple of weeks. When logging in to O365 the script is not finding the expected URL for a successful login. As a result, it asks for a new password, then tries again, asks again, then the script continues, gives an error message with the URL that it didn’t like, maps the drives correctly, then pops up an error message saying that mapping was unsuccessful. I suspect that Microsoft have changed the format of the URL… Read more »
Bobby Lansing
Guest

Same issue Jos. We discussed this a few months ago, but I think Chris L-M explained it better.

Emil Sandberg Lyngved
Guest
Having an issue with a new user, all the other users work fine, but this one does not. we are using version 3.0.8 — after a lot of retries and after entering the passord, a box pops up saying: “Mapping cannot continue because we cannot detect your username”. and also the script itself is reporting in red: ERROR: Failed to find the correct controls at (customers site) to log in by the script. The element cred_keep_me_signed_in_checkbox was not found (2) or had no tagName. what could be the problem? the only user it doesnt work for is this one, and… Read more »
Simon
Guest

Hi Jos,
The POST Login redirect issue seems to have reared its head again.
Are you aware if Microsoft has made any URL changes again that could be effecting the script?
Thanks
Simon

Handun
Guest
Hi Jos, I have used your script to map SharePoint drives in one of my client’s environments. However, every time when the scripts is executed, it asks for a Office 365 password two times. I haves used the version 3.08. After getting the password, even with several errors, script runs until the end, and maps the drives. However, users are complaining that they have to enter O365 password twice. I have used a Logon script to execute the PowerShell script. Please advise. Following is the error log. 07/03/2017 14:58:53 | INFO | —–07/03/2017 14:58:53 OneDriveMapper v3.08 – bookkeeper on TEST-WS03… Read more »
trackback

[…] OneDriveMapper […]

Mickael Selander
Guest

We just started to get an login promt seems to only accure on our Win7 machines, ADFS says wrong password or username but I can successfully login with SSO on the users machine but not in the script. anyone recieved anything simulare?

Mickael Selander
Guest

Spoke to soon seems to be everyone or almost everyone,
I altered the parameters so it couldn’t continue if no ADFS server is found, then I get an error saying that SSO Provider is available

Mickael Selander
Guest

That’s version 3.07 that gives that error but that seems to still map the drive but version 3.08 still promts for password

Mickael Selander
Guest

now if i set abortifnoadfs to true i get the same error on 3.08 and a mapping but also the same error

Mickael Selander
Guest

I turn of error showing so that could work for now but something regarding the connection to our ADFS server seems to be problematic for the script. SSO for Office365 and other applikations work fine.

Kevin De Schrijver
Guest

The script seems to return error at the moment. Sharepoint is up and running and no outages reported. But the script needs to be run several times and password needs to be entered multiple times (even with username and password stored) at the moment. Could be a Microsoft issue or perhaps they’ve changed something the required an update to the script.

Chris L-M
Guest

This is also happening to everyone in my office. We were successfully using v2.53 for a long time. Last week it started asking for the password, then asking again, then mapping the drives, then saying that it had failed. It seems that MS have changed the format of the URL that is received after a successful login and this is causing the script to incorrectly identify that login was not successful. 3.08 fixes the issue WHEN native auth works, which for us seems very hit and miss.

Kevin De Schrijver
Guest

I can replicated the problem anywhere using UserMode6. It fails a couple of times on the password. If you run the script enough times it goes through eventually but not without errors. Definately could use a comment from @Jos

Tom
Guest

Hi Jos

The script is working perfectly for us, however if a user opens an Office file from the mapped drive and they haven’t signed in to Office 2016 they are prompted for their password. Strangely though if they close the prompt then the file does open.

From what I have read this is due to how Office works with WebDAV, but wanted to see if other people are having the same problem.

Thanks

Luke
Guest

Hi Jos, this script is amazing and I love it, however I regularly get an error “>AADSTS165000: Invalid Request: The request tokens do not match the user context.” which causes fallback mode.
That’s not a big problem, except that once signin in fallback mode is successful, a modal appears underneath every other open window titled “Are you sure you want to leave this page?” with “Message from webpage: null” and two buttons to either “Leave this page” or “Stay on this page.”

Is anybody else getting this?

Peter H
Guest

We’re getting this also. Strangely though it doesn’t occur on all our Terminal Servers and also not with all user accounts. It can be a little bit hit and miss to be fair. I’m so glad that someone else is getting this though as I’ve been pulling my hair out for the passed week…

Aart
Guest

Yes, if using version 2.53 this error appears last few days. Tomorrow I tried using version 3.06 and then all is working well without this window.

Kevin De Schrijver
Guest

Has anyone found a solution for the slow upload speeds towards OneDrive/Sharepoint using Windows Explorer? Already deactivated the “Automaticlly detect settings” in IE but still getting abysmall upload speeds

Sam
Guest
Hi Jos, OneDrive mapped has stopped mapping OneDrive this morning for all our users, still maps the additional Sharepoint sites, just not the OneDrive, error below; Mapping target: \{domain}-my.sharepoint.com@SSLDavWWWRootpersonal{user_domain}Documents ERROR: detected string error 224 in return code of net use command, this usually means your trusted sites are misconfigured or KB2846960 is missing failed to contact H: after mapping it to \{domain}-my.sharepoint.com@SSLDavWWWRootpersonal{user_domain}Documents , check if the URL is valid. Error: 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… Read more »
Jason
Guest

I also have the same issue.

I try to remove all sharepoint site link, just map the personal onedrive, it was working fine.

Kevin De Schrijver
Guest

Feature request: Great script. I have hidden the powershell window but at the moment the statusbar “Mapping your Office 365 Drives” is persistent and cannot be minimized during the mapping stage.

Could you make it minimizeable so that users have the choice to wait for their drives to connect or open another application and start working without the statusbar stuck in their face.

trackback

[…] OneDriveMapper […]

Márton Bacsó
Guest

Dear Jos,

I have just upgraded the script from 2.38 to 2.43. Now it only works when I set “userLookupMode” to 4 and it still asks for my e-mail address in a pop-up window, although I have saved both my username and password into the script. 2.41 from TechNet gives me the same error message:

“A username was already specified in the script configuration: bacsom@thankaroly.hu
userLookupMode is set to 1 -> checking Active Directory UPN
Failed to lookup username, active directory connection failed, please change userLookupMode”

Your help would be greatly appriciated!

Trond
Guest

Jos, suddenly one computer got the error “userLookupMode is set to 3, but we failed to detect a proper username” in the log. While manually doing the lookup for SID and, username and SAM, everything seems normal, also the registry keys are in place.
Here are the contents from HKLM Reg key: (Added a bunc of X’es)
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IdentityStore\Cache\S-1-12-1-2648678820-1127942705-2445130163-XXXXXXXXXXXX\IdentityCache\S-1-12-1-2648678820-1127942705-2445130163-XXXXXXXXXXXXXXXX]
“UserName”=”guxxxxxxxx@xxxxxxxxxxxxxkk.no”
“SAMName”=”XXXXXguXXXX”
“DisplayName”=”guxxxxxxxx@xxxxxxxxxxxxxkk.no”
“ProviderName”=”XXXXXX”
“ProviderGUID”=”{XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXXXX}”
Also, while debugging, I tried to set username in the file, but that logic is not honored any more. It stills try to use the UserLookupMode.
Delete that whole section: “switch($userLookupMode)”
and where able to use username.
Do you have any clue what could be wrong?

trackback

[…] OneDriveMapper […]

JamieA
Guest

Hi Jos,
I’m trying to get the native method working on Windows 10, but I’m having an issue.
When the script gets to line 1856 (in v3.11), $nextURL is set to -1 which means when line 1896 is reached and JosL-WebRequest is called, the line [System.Net.WebRequest]::Create($url) is trying to create a webrequest using the url -1, which obviously isn’t a valid URL.

René
Guest
Hallo Jos, Het script is echt nice en werkt goed. heb alleen 1 probleeem dat het na een tijdje de verbinding verliest met Sharepoint en onedrive. dan krijgen gebruikers er rode kruisen door. je kan de schijven dan weg halen en script opnieuw opstarten en dan werkt het weer of inloggen op scharepoint via IE en dat herstelt de verbinding ook weer. dus erg raar en denk dat het een soort time out als je een bepaalede tijd bent ingelogd ofzo. jij toevallig ervaring mee en weet waar dat aan ligt? allen het script nogmaals uitvoeren zonder de schijven te… Read more »
Jordan Woodward
Guest

Hi,
The script works perfectly on Windows 7, however after testing it out on Windows 10 the drive does not map for some reason. It prompts me for the credentials but does load the drive?

Any help would be appreciated.

Thanks.

Jordan Woodward
Guest

does not load the drive!*

Thijs
Guest

Hi Jos, in our company we are having problems with the webdav to SharePoint teamsites + OneDrive. Lately we are having the problem that files which are uploaded on the webdav will become ’empty’ as in size 0kb. When opened in Office 365 it will show the document, but when downloading and opening in the local products it will not show the document and give a fault. Can you help us with this problem?

Rob Nicholson
Guest

Wow – just printed the script out to understand how it’s working and 80 pages! Maybe one for tomorrow 🙂

John
Guest
Hello everyone and thankyou onedrivemapper script has been brilliant, however for a couple months now it hasn’t been as reliable as it used to be. running when a user logs in in basically doesn’t work at this point anymore and if a user runs in manually it has a higher success rate manually running its works probs 60% of the time. We use adfs single sign on We cannot see anything obvious as to why apart from a couple errors in the script which i cannot see an answer for. the errors we commonly see are ERROR | Error received… Read more »
Eirik
Guest

I’m getting the 224 error now, it says:
“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 a
utomatically.”.

I’m using native mode without adfs, so I don’t see why this is happening?

Jordan Woodward
Guest

Hi,

I work in a school and this script is an absolute dream!

It works pretty much perfectly however I cannot get it to SSO as it takes the users log in username but requires the password. Is it possible to take AD credentials for both username and password? We use RM Unify, I have had a look through the script and changed to what is necessary for RM Unify but the password is still required. If we could get this working then this would be amazing.

Any help would be appreciated!

Thanks.

Eirik
Guest

Hi, I’m trying to run this script for a colleague using IE function. I keep getting this error: “failed to detect or use logged in Tile in IE: Method invocation failed because [System.__ComObject] does not contain a method named ‘IHTMLDocument3_getElementById’.
This is followed by “Ie login function succeeded”, but that also fails. System error 224: Add it to the safe zone etc. in IE. I have done this. Any idea what could be causing this?

Jose
Guest

I made the mistake of running the script without changing anything.
can I undo any system changes that have been made?

Ian Wilde
Guest
Hi, I wondered if anyone can help. We have the One drive mapping working great using this script (Many thanks). What I am looking for is to create a second one which only runs if a user is a member of a certain security group (Which I am able to do)., then maps a separate sharepoint drive. How could I create the second to not cause issues with the first mapping? I’m having limited success so far in that if the test user logs on again there appears to be issues with the one drive mapping. Many thanks in advance… Read more »
Dave
Guest

Hi, your script is nothing short of genius. I just had one quick question, how easy/difficult is it to add 2 SharePoint sites to the sharepointmappings variable?

Sean
Guest

Thanks for the useful script. On one client, I’m receiving a message that states “Mapping cannot continue because we could not log in to Office 365”. I’ve verified the credentials are correct and that I can login to Office365 manually with no issues. I’ve tried removing the .tmp files where the creds are stored and reentering them but still receive the same message.

Any help is much appreciated.

Sean
Guest

Any ideas on this one? This is preventing me from using the script at one of my clients.

Anybody else getting this?

Eirik
Guest

Hi, I have a problem where I am asked for password. If I enter the wrong password 3 times in a row, it still maps the drive successfully via IE function, and then incorrectly shows a message saying that the mapping cannot continue. Any way to fix this? I don’t want users typing in a random password getting access.

Henrik Skovgaard
Guest

I am getting an error saying:
ERROR | ERROR: Failed to set test cookie, script will fail: Exception calling “SetWinINETCookieString” with “3” argument
(s): “Exception setting cookie: Win32 Error code=2”

and then later in the output, I see this one:
“ERROR | ERROR: detected string error 224 in return code of net use command”

I have tried both v3.10 and v3.11 with same result.

Sam
Guest

Hey Jos, Thanks for that great Script which works just fine in GermanCloud until I enable MFA for a user. I can’t figure out what the problem is. Do you have any hint for me what to analyse?

Rick de Vries
Guest

Anyone notice OnedriveMapper no longer mapping drives and coming up with error message that the website is not listed in the Trusted Sites list, while it actually is? I had a few users experience that in the past few days and each day another user experiences it, so the list of users unable to map is growing.

Evan Riser
Guest

Great tool! Where do we stand on MFA support?

Gfelli
Guest

Hi Jos, don’t know if someone else has tried. I have change all .com to .de in the script for a customer and now he is using the script with a DE-Trustee O365 tenant… Just to let you know.

Bas Peeperkorn
Guest

Hi Jos, great script and using it for some time now.

But how can i manage to create one script that creates a Drive for my current company and a Drive for my external company. My Office 365 account has external rights for the other company.

Thanks in advance!

Bas Peeperkorn
Guest

Any update about this Jos?

Lee
Guest
Thanks for the great script Jos – came across an interesting issue recently that may interest you. Client moved from on-premise server to Azure server for terminal services and as such went from an on-premise AD environment to complete Azure AD structure. Whilst OneDriveMapper worked fine when Azure AD Connect was in use and SSSO enabled, once AADC was disabled the scripts login began intermittently failing on the Azure AD server. I found that disabling AADC was not sufficient to also disable SSO or to prevent its use, and as such your script by default would detect SSO as enabled… Read more »
Lee Chance
Guest
Greetings. I have been tested this for my company to move personal(P) drivers to one drive for business. I have found I cannot move a file larger that about 315 megs without getting an error. Anything below that in size seems to work. It also seems like I can pull any file from the mapped network drive to my local drive of the same size without getting an error. Moving to local also gives me a security prompt as well. Any Ideas on how to fix this. I have changed all webclient settings in registry to max.
trackback

[…] and we might find that this particular issue is resolved. We used this for the file migration: OneDriveMapper | Liebensraum I think you're correct on WebDav and SharePoint being the issues rather than specifically CDM. I […]

Scott Adams
Guest

Getting error 53 on clients that are RDP’ing into Server 2012 and Server 2016.

The script works flawlessly on clients logging into Windows 7, Windows 10, and RDP’ing into Server 2008 R2.

Thoughts?

I do not see a “trailing /” in my script.

trackback

[…] Posted by snagrat Can I ask how you are redirecting My Docs to OneDrive? Take a look at this OneDriveMapper | Liebensraum if you are after a free solution or want something to test with a small group of users before […]

Jason Komendat
Guest

Jos, we’ve been using your script for sometime now and its great. I was wondering if you could help us with an issue on a few PC’s it just doesn’t work. i was going to just reimage them but everything else works on them but this the drive doesn’t map

08/30/2017 07:56:58 | ERROR | failed to contact U: after mapping it to \\crdistrict-my.sharepoint.com@SSL\DavWWWRoot\personal\24jmullett_cr_k12_ia_us\Documents, check if the URL is valid. Error:
The network path was not found.

System error 53 has occurred.
The network path was not found.

Jason Komendat
Guest

Also it seems its just our Windows 8.1 machines its not working on. On Windows 10 it seems to still work.

Sol
Guest
I have been using this powershell script for sometime and its great, I always update to the latest version. One issue we have come across is that the script does not put Internet Options zones back to protected mode. This causes issues with some outlook addins, the new onedrive sharing and skype logins. Skype just says that javascript needs to be enabled. The onedrive sharing just keeps on loading and loading. outlook addins needs to have restricted zone as protected mode. Resetting the internet options work, we are looking into creating a powershell script to enable those after this onedrivemapper… Read more »
Hasan
Guest

We are in the process of locking down TLS 1.0 on our firewall and notice that OnedriveMapper v3.09 is connecting using TLS 1.0 instead of TLS 1.2 Is there a way I can force it to connect using the newer TLS version?

trackback

[…] Posted by nickbro We started using the onedrive mapper which is free from OneDriveMapper | Liebensraum Just did a copy job with all the user files up to their personal onedrive for business accounts […]

Ronald
Guest

Hello, Jos great script. We are testing it right.
The mappingscript works perfectly except one thing.
We have use O365migrator to migrate the homefolder to a subfolder on Onedrive.
We want Onedrivemapper to map to that subfolder.
So i used the the variable $redirectToSubfolderName in the script but OnedriveMapper does map to that subfolder but to the root of the users Onedrive

Eddie
Guest

You need to use the $libraryName variable instead of the $redirectToSubfolderName when mapping to a subfolder. So, something like $libraryName = “Documents\HDrive”

Ronald
Guest

I found out that the variable is used for redirecting folders like “favorites,downloads,etc”

Eugene
Guest

Does anyone know if you have a drive mapped to a specific letter, if the scipt recognize that and not overwrite the previous mapping?

Buster
Guest

Jos, Any version above 2.53 for me is broken and requesting user password. Oddly though 2.53 still works without issue. I’ve been testing with 3.06,3.08,3.09,3.10 and 3.11

Andrew
Guest
Hi Jos. I’ve moved on from OneDrive mapping (which is working great with your script) to a sharepoint site. In your installation comments you advise not to use spaces in the path, but this seems unavoidable if mapping to the shared documents space on the sharepoint site (eg our $sharepointMappings += “https://ourtentant.sharepoint.com/staff/humanresources/Shared Documents,HumanResources,S:”). What are the consequences of this space? It seems to work as written. What problems should we be looking for? I’m really not very familiar with Sharepoint – we’re only just starting to move towards it. I notice in your code example in the script that you… Read more »
Toby Bierly
Guest

I can’t remember exactly where, but a couple weeks ago I was noticing an error in the script log because of the space in Shared Documents. I think the script ended up completing successfully, but I remember I was able to get rid of the error altogether by changing that part of the SharePoint mapping path to Shared%20Documents

Andy Harper
Guest

Hi Jos – Very long time user of the scripts since early on, seems like yesterday. So I continue to be thankful as you help the teachers at our school be more efficient with their time in using OneDrive like a local path. Just wanted to share that I did the upgrade to 3.11 and still got the 3 prompts for user initial login (cache). I removed the “?msafed=0” from the script and that seemed to fix it immediately. Just an fyi, or do you have thoughts?.. Thank you – Andy

L_D
Guest

Hi there

These are my PS messages

“Logged into Office 365!”

Retrieving Onedrive for Business cookie step 2 at https://onedrivemapper-my.sharepoint.com/_forms/default.aspx

” Waited for 0 seconds for O4b auto provisioning…” and it never goes past this.

What am I doing wrong if I am able to login?
I have an idea that SPOTenantSyncClientRestriction has been enabled. Would this script connect to my OneDrive despite not being added to a domain?

rashannw
Guest

$Domain is not stipulated in the script. Is there a reason why it is missing?

trackback

[…] OneDriveMapper […]

Notty
Guest

Hi Jos, You have created a great script in the world!! Respectful.

By the way, as you know the authentication UI of Office 365 changes soon. If possible we would like to improve the script to accommodate the new UI.
Are there plans for improvement??

bashr
Guest
Hi Jos, Great Script!! I have been using it for a long time now but since a couple of days I am having problems to run it. Log file: 00000001 08/11/2017 00:10:56 | INFO | —–08/11/2017 00:10:56 OneDriveMapper v3.10 – userX on DESKTOP-sdfssd starting—– 00000002 08/11/2017 00:10:56 | INFO | Script elevation level: User 00000003 08/11/2017 00:10:56 | INFO | Set TLS protocol version to 1.2 00000004 08/11/2017 00:10:56 | INFO | You are S-1-5-21-1149768150-2677177873-1229523166-1001 running on Windows 10 with IE 11 and Powershell version 5 00000005 08/11/2017 00:10:56 | INFO | Loading CookieSetter… 00000006 08/11/2017 00:10:56 | INFO |… Read more »
Mark C
Guest

Hello Jos,

Awesome script by the way just have a quick question.

We used an old version 2.39 and updated to 3.10 as it was having issues with the mapping.

Now it keeps prompting for a password which after entering 3 times does show the mapping, but cannot interact with any files as it is not fully logged in

Any comments will be appreciated!

Thank you

Peter H
Guest

Hi Jos, great new release as usual. One question I have which may or may not have been covered here: if I run this on Server 2012 R2 the script does not run for maybe 4-5 minutes then I will get a visual pop-up of the PowerShell script and it will run perfectly fine and map my drives…
Any ideas what I’m missing?

Simon
Guest
Hi Jos, I have 2 questions, first one is? We have updated to use the v3.10 but we are still getting the ‘Mapping cannot continue because we could not contact Office 365’ error pop up but the drive maps fine? This is occurring on laptops & desktops. Here is the part of the log where the error occurs; 08/10/2017 15:11:00 | INFO | Zone 2 was set to 3, setting it to 3 08/10/2017 15:11:01 | INFO | Base URL: https://portwaratah-my.sharepoint.com/_layouts/15/MySite.aspx?MySiteRedirect=AllDocuments 08/10/2017 15:11:01 | INFO | Zone 3 was set to 3, setting it to 3 08/10/2017 15:11:02 | INFO… Read more »
sebus
Guest
Not working (3.09 and 3.10) for the last few days: ERROR | There was an issue while trying to log in during attempt 3 INFO | detected user logged in Tile in IE INFO | login detected, login function succeeded, final url: https://portal.office.com/AdminPortal/Home#/homepage INFO | IE login function succeeded INFO | Detected user: user_domain_com INFO | Onedrive cookie generated, mapping drive… INFO | Mapping target: \tenantname-my.sharepoint.com@SSLDavWWWRootpersonaluser_domain_comDocuments ERROR | ERROR: detected string error 224 in return code of net use command, this usually means your trusted sites are misconfigured or KB2846960 is missing ERROR | failed to contact O: after mapping… Read more »
trackback

[…] OneDriveMapper […]

Morten Wiingreen
Guest

Hi Jos.

When using OnedriveMapper 3.09 in IE mode (debug) Internet Explorer stops at loginpage (https://login.microsoftonline.com) showing my upn name.
If I do nothing the script waits for sso (10 sek count) and eventually asks for my password two times. Onedrive is mapped if I type in password.
If I press my name in the browser and logs into https://login.microsoftonline.com, the script is finishing without any problems and onedrive is mapped.

Any idea why IE does not log in ?

Best regards and thanks for a great script.

Ferron
Guest

Hallo Jos,

Wat is er precies veranderd bij Microsoft met de POST login redirect? Heeft Microsoft hier zelf wat over geschreven? Ik heb namelijk last van een probleem dat hierdoor is veroorzaakt, maar ik kan nergens vinden wat veranderd is.

Alvast bedankt!

Matt R
Guest

Hi Jos,

First of all I wanted to thank you for the script. I am having an issue with delayed logins and with drives failing to map. I think it is because I have some settings wrong. Is there a way you can look at the log and make a recommendation?

Phil Warren
Guest

When a new user logs on for the first time explorer.exe hangs indefinetley unless you manually start it from task manager. Once the user has a roaming profile the script runs and explorer starts as expected. if we remove the logon script then a new user logs on as expected so we know it is something in one drive mapper that is causing the issue. Any ideas why this might be happening would be gratefully appreciated.

Matt
Guest

When we try to map our sharepoint drive, we receive the error

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.

If we login to IE and retry, the script completes. Should the script work without the requirement to login manually?

Many Thanks

MJ TFSB
Guest

How do I log back into my OenDriveMapper Configuration? I can’t find a link or URL. I am having difficulties getting the msi to run on non-administrator users and need to check my settings.

Gary
Guest

Hi Jos,
v3.09 – It appears that the check for MFA is only used in the IE mode authentication. Can you work this into the native auth mode as it is an issue we are encountering, especially a challenge when users need to re-validate their MFA details.

Also the script appears to fail if the user has a profile configured in AD to point to a share (their ‘legacy’ home drive), but if we clear the profile then it works perfectly. If the profile is mapped then there is an error setting the cookie.

Many thanks

Duncan Wraight
Guest

Hi Jos. I’m encountering a bizarre problem on some of my machines where, when running the script as a GPO logon script (using Powershell.exe and the associated commands, as instructed), the log in %appdata% appears to suggest that the script tries to run a scheduled task… then nothing happens. Have you seen this before? 07/17/2017 12:03:09 | INFO | —–07/17/2017 12:03:09 OneDriveMapper v3.09 – DS on AHS-31-21 starting—–
07/17/2017 12:03:09 | ERROR | Script elevation level: Administrator
07/17/2017 12:04:10 | INFO | Scheduled a task to run OnedriveMapper unelevated because this script cannot run elevated
07/17/2017 12:04:10 | INFO | Scheduled task started

Gabe W
Guest

Hi, we do not use ADFS but we do use OneLogin. This seems to cause problems because it seems to redirect to OneLogin and then not get the response it is expecting and then fails.

| ERROR | Failed to find the correct controls at https://xxxxx.onelogin.com/login to log in by script, check your browser and proxy settings or check for an update of this script (2). Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

Is there a way around this? Other than using IE auth and getting the user to have IE already signed into Sharepoint Online.

Thanks

Luke Pollard
Guest
Hi, I’m trying to set this script up for our academy so that we can map out onedrive and sharepoint sites. I’m using the RM Unify SSO, and despite reading through your entire script I and changing the relevant logon settings still get a “WARNING | Federation Services did not sign us in automatically…” If I then manually type the password it throws an error in powershell on lines 1787 InvokeMethodOnNull, 1789 MethodNotFound and 326 URIFormatException. Using version 3.09 Any chance I can pass you some logs to take a look? I’d really love to get this working with RM… Read more »
Luke Pollard
Guest

I’ve noticed using fiddler when I run your script that the RM Unify provides a 302 redirect to the logon page, is your script trying to post the logon credentials to the page before the 302 redirect, if so is there a way to get it to post the username/password after it has redirected?

I have a saved a session archive from fiddler if you would like to take a look?

Thanks in advance,
Luke

Luke Pollard
Guest
So some further digging, RM Unify works in ie mode however it still prompts for a password when logging in. I’ve managed to add a few lines of code which triggers the RM Unify SSO page (https://.rmunify.com/sso) first, which then automatically logs onto Office 365 using the rest of this script. I’m just doing some further testing and then I’ll publish the code changes which has made this work. Only problem I’m finding is in Windows 10, when exploring through the folders it is extremely slow and often crashes the explorer. I have looked through the FAQs and disables auto-proxy… Read more »
Hari
Guest

Hello Luke

Is the script working fine for you with RMunify? Could you please share to me?

Duncan Wraight
Guest

OK, sorry Jos, I’m back. I posted a comment earlier about my username being incorrect then I sorted that by changing the $userLookupMode variable. However, having changed that, I still end up with the same result: 07/13/2017 11:42:20 | INFO | login detected, login function succeeded, final url: https://www.office.com/?auth=2&home=1&from=PortalLanding&client-request-id=2c44963b-4058-4005-b35c-b806fa46f297
07/13/2017 11:42:20 | INFO | IE login function succeeded
07/13/2017 11:42:24 | INFO | Attempting to detect username at https://[mydomainreplacement]-my.sharepoint.com/_layouts/15/MySite.aspx?MySiteRedirect=AllDocuments, waited for 0 seconds

Is there somewhere I could send you my full log to have a quick look? Hopefully it’s something silly that I’m doing wrong.

Thanks,
Duncan

Duncan Wraight
Guest
Hi Jos. Firstly, thanks for the script – loads of work and it’s a brilliant implementation. I’m having issues with the username side of things. Early on when the script runs, it says: 07/13/2017 11:19:41 | INFO | Login attempt using IE method 07/13/2017 11:19:41 | INFO | Found sign in elements type 1 on Office 365 login page, proceeding 07/13/2017 11:19:41 | INFO | Found sign in elements type 2 on Office 365 login page, proceeding 07/13/2017 11:19:41 | INFO | Found sign in elements type 3 on Office 365 login page, proceeding 07/13/2017 11:19:42 | INFO | Will… Read more »
Duncan Wraight
Guest

Ahhh.. never mind, I’ve just found this line in your config! $userLookupMode = 4 #1 = Active Directory UPN, 2 = Active Directory Email, 3 = Azure AD Joined Windows 10, 4 = query user for his/her login, 5 = lookup by registry key, 6 = display full form (ask for both username and login if no cached versions can be found)

Steph
Guest

Hi Jos, I’m not sure if it’s a big or the way you intended it; but if the mapping goes through successfully and then somehow your drive(s) get disconnected, but the tmp files still exist, it does not remap your drives. I’m using v3.09. Thanks!

Yasin Akbulut (NL)
Guest
I have a question about this submission to the FAQ of yours, it still doesn’t work with my GPO configuration: “How do I run the script from a GPO? First off, do not run it as an embedded powershell script. Add it under ‘scripts’ as a normal script with commandline/name: Powershell.exe Then the arguments or parameters you should specify are: -ExecutionPolicy ByPass -WindowStyle Hidden -File if you omit -WindowStyle Hidden the script will execute visibly. File HAS to be the last parameter.” It’s still not working and i don’t quite understand with your instruction you submitted in your FAQ, so… Read more »
Yasin Akbulut (NL)
Guest

It’s still not working and i don’t quite understand [with] your instruction you submitted in your FAQ, so I will tell you what kind of GPO I’ve configured*

Peter H
Guest
Hi Jos, Script working amazingly well with no errors or warnings apart from one which keeps cropping up and I think i’ve mentioned previously… ERROR | ERROR: Failed to connect to API url for version check: http://om.lieben.nu/lieben_api.php?script=OnedriveMapper&version=3.09 Exception calling “GetResponse” with “0” argument(s): “The remote server returned an error: (407) Proxy Authentication Required.” Is there a line that can be added to the script anywhere to use default credentials or something similar to get around this. It isn’t detrimental to the Mapper functioning correctly, it’s just that it always says the script is out of date no matter how new… Read more »
Kevin Davies
Guest

Jos,

Where can I contribute to your wonderful script.

Cody Belcher
Guest
Hello Jos, (Apologies if this is a duplicate post, I am not sure I submitted my comment/question correctly the first time) My organization has made several changes over the past couple of months and of those was an upgrade from ADFS 2.0 to 4.0! Prior to the upgrade we were using Onedrivemapper v2.53, and are now using v3.09. After these updates we are getting the warning below (from the log). Looking for some advice on how to proceed. The entire log is farther below. | WARNING | Federation Services did not sign us in automatically, retrieving user credentials.. FULL LOG… Read more »
Cody Belcher
Guest

Follow up to the above, we have found that in ADFS management, under Intranet, Windows Authentication was not listed. We added it and now the script is working with no errors.

*Note* – We had previously removed this because of an issue with staff, using a district Window’s device, could not access the Office 365 portal from home when using Internet Explorer 11. It was stating it could not contact ADFS. It would work in all other browsers. This is still the issue after re-enabling Windows Authentication.

Skrie
Guest

The script works great… but, I’m trying to roam the mapping after the script created it. We’re using mandatory profiles with VMWARE UEM for usersettings. I can’t really figure out how to keep the OneDriveMapping. Does anyone have a list of regkeys/appdata folders that would maintain this mapping after it was created?

Maritin
Guest

I have problems getting the Cloud version to work
if i make the same config in the script everything works fine, but the cloud version says cant connct to your network

Niglbrown
Guest

On one machine in my office I receive the following log entry:

’07/07/2017 13:06:24 | ERROR | failed to retrieve settings from lieben.nu using 5D57CFC9-733C-C530-C46D-056D911F1FDA because of Exception calling “DeserializeObject” with “1” argument(s): “Invalid JSON primitive: incorrect.”, content of request: ‘
I noticed this would be generated by the ‘ConvertFrom-Json20’ function which relys on web extensions.

Any thoughts? I have gotten around this by using the cache from another machine on this machine to load the configuration.

Bobby Lansing
Guest

Hey Jos,
How do you feel about making the progress bar color a variable so we can custom theme the progress bar? I can edit the code, but it would be cool for the cloud product as well.
Thank you for an awesome product!

Petter
Guest

Hi,
Could I use OneDriveMapper Cloud if I must use $userLookupMode = Active Directory Email ?

Rogier
Guest

Thanks for the updated version 3.09 Jos!
We had some issues this morning but this version works fine!

Kevin De Schrijver
Guest

I assume Jos is on holiday at the moment. Has anyone found a fix or workaround to the current issues with the script?

Toby Bierly
Guest
We and all our customers where we have deployed OneDriveMapper all started getting prompted 3 times for the user’s password and then the script fails. It will not succeed even with the correct password. We were running 3.06 but 3.08 fails as well. We just noticed this last night. We are not using ADFS. We are using $userLookupMode = 4 and storing the credentials in tmp files. The log doesn’t show anything that reveals the issue. All it says, after retrieving the password from the cache, is “ERROR | There was an issue while trying to log in during attempt… Read more »
smichael
Guest

Great Script Jos – is there anyway to make the Winform username dynamic & pull what a user types in instead of hard-coding something like a SP site?

David
Guest

Hi,

We have successfully got the script to map and it all works perfectly.

However, during the mapping process when a user initially logs on and it says “OnedriveMapper v3.08 is connecting your drives…” PowerShell opens in the taskbar and a user can then open a full PowerShell terminal before entering their Office 365 password.

I have hidden the script output etc, PowerShell still seems to sit in the task bar.

Is there anyway to hide any trace of PowerShell??

Thanks,

Patrick Lubbers
Guest

Hi Jos,
Since a week and a half the onedrivemapper script intermittently fails at our organisation. It seems to time-out.
Has anyone else reported this issue?
It doesnt matter if we use either 2.49, 2.52, 3.08

Usmaan
Guest

Hi Jos,
further to the previous post, Im using User lookup mode 6 .
Also, there’s no log file created in the %APPDATA% folder, so i suspect that it’s not executing

Usmaan
Guest

Hi Jos,

I’m using the OneDriveMapper cloud config using the MSI.
When I run the MSI using the ID created online, i get a warning message box stating “The specified account already exists”

I’ve tested the online configuration using the .PS1 file and that works, so it must be something with the way I’m running it my Windows 10 Pro machine

Rogier
Guest

Hi Jos we have some issues with the first authentication method.. seems like adfs in the logs.. were looking into this… but the strange thing is that the user gets to see a powershell window this is when it tries to fallback on alternative login methods.. is it possible that we can hide this 2nd script?

Larry
Guest

Great script and a VERY useful resource. Thank you for creating this.

Have you noticed issues if the environment has IE under GPO control already?

MPA
Guest

Hi Jos,

I’m not sure what i’m missing, but i’m having a hard time mapping OneDrive for Business with your script. We are using Okta for MFA. Any help would be appreciated.

Thanks

Andrew Heys
Guest

We are having the issue below

06/20/2017 11:54:20 | INFO | configurationID set to IdNumber, retrieving associated settings from lieben.nu…
06/20/2017 11:54:24 | ERROR | failed to retrieve settings from lieben.nu using D601F6AF-D8DF-91B6-029A-3FB2A40E39A6 because of Exception calling
“GetResponse” with “0” argument(s): “The remote server returned an error: (407) Proxy Authentication Required.”, content of request:

Winson
Guest

Hi Jos,

I would like to map the SharePoint only using the OneDrive Mapper. Could you please kindly advise how I can disable the mapping of the personal OneDrive for Business? Thanks!

Luke
Guest

Hi Jos,

We really like the script. However we want to roll it out to the business. Do you have a supported paid version? (autoupdates) or know of any good paid versions?

Thanks

Darko
Guest
Hello Jos, I’m just testing your OneDriveMapper v.3.08. Great work, thank you. Altough it works without any problems in interactive mode (when user is logged in or at least locked) I found that it can’t run if it is started via WindowsTask and user is not logged in. In this case I got a log events like this: 06/10/2017 22:25:12 |INFO | —–06/10/2017 22:25:12 OneDriveMapper v3.08 – dare on EXTRA12 starting—– 06/10/2017 22:25:12 | ERROR | Script elevation level: Administrator 06/10/2017 22:25:13 | INFO | Scheduled a task to run OnedriveMapper unelevated because this script cannot run elevated 06/10/2017 22:25:13… Read more »
Rudolf
Guest

Hello Jos,
I really like your script!
One addition would be nice. When a scheduled task is created, the -NoProfile option should be included. I get a popup to login to my O365 sessions every time the script runs, which is pretty annoying. I added it myself, but I think it should be standard.

For the rest: keep up the good work!

Mark
Guest

For some reason my mappings dissappears during the weekend. We’ve installed OneDriveMapper on our Citrix farm, and it works for a week, then it pops up and tells the user to log back on and check trusted sites. Anyone else experiencing this? Does this only happen if trusted sites is misconfigured (which it isnt) ?

Joe
Guest

My users have been getting prompts in Citrix too as of a couple days ago. It also looks like our Azure AD Connect SSO stopped working in general. Still investigating if they corelate.

wpDiscuz