OneDriveMapper

OneDriveMapper is a free (non-commerial use), open source script I wrote to be used as a logon or on demand script to map OneDrive for Business and/or Sharepoint Online to driveletters and/or Network Locations, it has been downloaded over 2,500,000 times and has millions of users.

It was designed to run in scenario’s where using the Onedrive for Business client is not feasible, such as legacy 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.

Download open source version:

OnedriveMapper V3 / older releases (does not support all types of MFA, conditional access etc but has more features. Still seems to work on all OS’es but can be retired by Msft anytime without warning)

OnedriveMapper v4 (very lightweight and simple version that supports all kinds of MFA but depends on Internet Explorer)

OnedriveMapper v5 (next iteration of v4 using Edge instead of Explorer, but does not work on older OS’es like W2008/2012)

Enterprise alternative (with support & discount):

IAM Cloud Drive Mapper

How to install (instruction for V5)

  1. Make sure Edge Chromium is installed
  2. Make sure .NET 3.5 and PowerShell v3 or higher are present on the Machine
  3. Download the latest version at GitHub to a network share or your devices
  4. Download the Selenium Webdriver.dll from NuGet or GitHub to the same folder as OnedriveMapper.ps1
  5. Download the Edge msedgedriver.exe from NuGet to the same folder as OnedriveMapper.ps1 or ensure autoUpdateEdgeDriver is set to $True (default) and the user has write-access to the script’s location
  6. Add https://tenantname-my.sharepoint.com to your Trusted Sites list if mapping to O4B
  7. Add https://tenantname.sharepoint.com to your Trusted Sites list if mapping to Sharepoint Sites, O365 Groups or Microsoft Teams
  8. 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.
  9. Set $O365CustomerName to your Tenant Name (xxx.onmicrosoft.com) in the script’s source code
  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.

Maintenance

the msedgedriver.exe file requires that the version of Edge installed on your systems is similar. So if you update Edge, the edge driver also has to be updated. OnedriveMapper will try to do this automatically by default, but if the user that runs ODM does not have write access to the same folder as the script, this will fail and you will have to update the edge driver manually.

When do I use OnedriveMapper?

In short: only when you have no other choice!
With Files On Demand and GPO support for passthrough auth and automatic mapping of sharepoint and teams sites, the need for OnedriveMapper has been greatly reduced. When you’re thinking of adopting VDI, go Azure Virtual Desktop with FSLogix instead of OnedriveMapper.

Please try to make the effort to educate your users, don’t swim against the current; start embracing new cloud technologies.

If you really have no other option, e.g. you have automated processes you cannot yet rewrite to use the Onedrive API, or are working in a W7/W2012 multi user environment and can’t just use the web interface. Do make sure your systems do not fully depend on mapping drives as they could break at any time, WebDAV is not a very….’recent’ technology and Microsoft does not give any hard guarantees as till when it will be supported.

So what does OnedriveMapper do?

  • Runs at logon or on demand (group policy, RES, etc)
  • Maps to Onedrive for Business (with auto detection of the user’s URL)
  • Maps to Office 365 Groups and Teams
  • Maps to Sharepoint Online
  • No Sync, online WebDav connection over HTTPS
  • No user interaction if SSO is enabled
  • On Demand Provisioning of the OneDrive MySite
  • Detailed and configurable logging
  • Map based on AD security groups
  • Custom labeling of drives
  • 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 or Citrix Seamless Apps
  • Can redirect OS folders (like My Documents)
  • Can converge multiple mappings in a single driveletter
  • SSO for MDM Intune AzureAD W10 devices
  • Can be deployed as logon script through Intune
  • Can easily run from a shortcut as well

Recommendations

Limitations

  • If SSO is not configured or MFA is required, the script will show the user a popup to authenticate
  • This script does not work Powershell V2 or lower (comes with Windows 7), install V3 or higher
  • This script does not operate on Windows 2012 R2 (or lower) as the Selenium webdriver component does not support this.
  • If libraries become too big (total count of files and folders) webdav will show an empty drive

Disclaimer

I’m not a real programmer, this code is meant as an example. 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 before you use it. This script may suddenly become obsolete without prior warning if Microsoft feels that WebDAV should no longer be supported. For an enterprise worthy and supported product, I recommend using IAM Cloud Drive Mapper instead of an open source script. If you use LIEBEN25 as referral code with IAM Cloud, you’ll get a 25% discount.

old changelog

FAQ

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

2.4K Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Ian
Ian
6 years ago

OnedriveMapper no longer mapping drives and coming up with error message that the website is not listed in the Trusted Sites list.. v3.13

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.

Dennis
Dennis
2 years ago

Hi, we are also testing the script but are receiving
—————————————————————-
“ERROR | Failed to browse to the Office 365 Sign in page, this is a fatal error Exception calling “GoToUrl” with “1” argument(s): “The HTTP request to the remote WebDriver server for URL http://localhost:60451/session/f37fe94c560bff82d4812ca5d9f5ecdd/url timed out after 60 seconds.”
xception calling “GoToUrl” with “1” argument(s): “The HTTP request to the remote WebDriver server for URL http://localhost:60451/session/f37fe94c560bff82d4812ca5d9f5ecdd/url
—————————————————————-
If we try to browse to the O365 Sign in page manually, everything is working fine. Any Ideas

trackback

[…] OneDriveMapper […]

Ricardo Fonseca
Ricardo Fonseca
1 year ago

When i run the script appear everytime this error

You cannot call a method on a null-valued expression.
At \\xxx\OneDriveMapper511.ps1:507 char:12
+     if($url.StartsWith($item)){
+      ~~~~~~~~~~~~~~~~~~~~~~
  + CategoryInfo     : InvalidOperation: (:) [], RuntimeException
  + FullyQualifiedErrorId : InvokeMethodOnNull

Pierre
Pierre
2 years ago

Hi, i add an issue with the v5 script with Terminal server with UPD. we have this message ERROR | Failed to load Edge driver, cannot continue. error details: Exception calling “.ctor” with “2” argument(s): “unknown error: MSEdge failed to start: crashed.  (chrome not reachable)  (The process started from msedge location C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe is no longer running, so MSEdgeDriver is assuming that MSEdge has crashed.)” the debug file of the driver give use that The GPU process has crashed 9 time(s) [8144:6328:1002/003038.737:FATAL:gpu_data_manager_impl_private.cc(426)]GPU process isn’t usable. Goodbye. i found the issue at line 1130 $global:edgeOptions.addArguments(“user-data-dir=$($Env:appdata)\Lieben Consultancy\OnedriveMapper\Profile”) with the UPD the appdata… Read more »

Bill Hixon
5 years ago

I’m having the dreaded 224 error come up regularly now. I’ve reset IE and rebooted, no change. I am getting this error before the 224:

Failed to set a cookie: Exception calling “SetWinINETCookieString” with “3” argument(s): “Exception setting cookie: Win32 Error code=4317”

Is this the cause, and if so, what do I do to fix this?

Edwin
6 years ago

Our mapped drives have stopped working. The error 224 is thrown when the NET USE command is executed. Did MS removed completely the “stay logged-in” option?

Rick de Vries
Rick de Vries
6 years ago

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.

Albert
6 years ago

Hi!! Thanks for the script! It is really great! i have been testing it in my environment and it works like a charm. The only drawback that I have, is when I configure O365 MFA on the user account, in my case it starts to send SMS text to the mobile, but is it not possible to bypass this step. I have seen that in the script you have something like “handle MFA in native auth mode” but I tried to put “native” and “ie” in $authodmethod in case to try all possible cases, but unfortunately with the same result.… Read more »

Adriano
Adriano
9 months ago

Hello
We are currently experiencing an issue with autosave and version histories.
These functions no longer work knowing that our sharepoint are under office 365 and they are mapped as a onedrivemapper
Do you have an idea ?

Alan
Alan
5 years ago

For those with a 224 error regarding access denied, I was able to solve my issue by updating my ADFS configuration to set persistent cookies which are required by WebDav per this article: https://blogs.technet.microsoft.com/sposupport/2017/09/16/cookie-persistence-in-sharepoint-online/

Chris L-M
Chris L-M
6 years ago

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 »

Sam
Sam
7 years ago

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 »

Vrajes
Vrajes
5 years ago

Thanks for the amazing script.. We are running into issue where your script is not working few Machins(Citrix VDI) . Looking forward for your help in fixing this issue . 1 . If i map drive URL via Net use fails 2. Use run command \\Path\\ works fine 3. If i map drive via Computer–>Map drive fails 02/14/2019 00:59:03 | INFO | Mapping target: \\XXXXXXXX.sharepoint.com@SSL\DavWWWRoot\personal\username_net\Documents 02/14/2019 00:59:04 | ERROR | ERROR: detected string error 67 in return code of net use command, this usually means the WebClient isn’t running 02/14/2019 00:59:04 | ERROR | failed to contact O: after mapping… Read more »

Andy
Andy
5 years ago

The script has and is working perfectly. Thanks Jos. However we have had OneDrive drops. This seems to be related to the cookie being deleted \ dropping. When this happens we get the trusted sites error. Running the script fixes until the cookie drops again. Anyone else getting this? We are on W10 various builds.

Maikel
Maikel
10 months ago

Since today we’re receiving an HTTP 403 when running version 3.22 of the script native auth. Just updated to 3.28, but the same error remains.

Maybe a change at Microsoft broke the script or am I overlooking something? anyone else seeing this?

INFO | Login attempt using native method at tenant xxxxxxxxxxx
ERROR | Unable to find user realm due to Exception calling “GetResponse” with “0” argument(s): “The remote server returned an error: (403) Forbidden.”
ERROR | native auth login mode failed, aborting script

Jason
Jason
6 years ago

We’re getting this error now

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.

We have the sites added to trusted sites and ave for a while.

We recently updated to Windows 10 1709 could that be a factor?

trackback

[…] OneDriveMapper […]

Emil Sandberg Lyngved
6 years ago

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 »

Kevin De Schrijver
Kevin De Schrijver
7 years ago

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.

Peter Sumner
Peter Sumner
10 months ago

we tried the IAM cloudmapper and it was a disaster, any time a GPupdate happened it went into a fit, we are asking for our money back. Long live the onedrivemapper script 🙂

Adam Huszar
2 years ago

OneDrive mapper v5 can work under Server2012r2, if you start from a shared network path, and let domain users to write data there.

Mike
Mike
6 years ago

Recently we have been getting error 224 out of nowhere. we haven’t made any changes to IE or the settings. We do manage IE settings via group policy but I cannot seem to find what the “misconfiguration” is. I tried to reset IE and still no luck. Any help would be greatly appreciated!

ERROR: detected string error 224 in return code of net use command, this usually means your trusted sites are misconfigured or KB2846960 is missing or Internet Explorer needs a reset

John
John
6 years ago

I have been using your script for months and only occasionally does it stop working usually there is a later version which fixes it for us but this time we are on the latest so am after a bit of help with the errors, I have been through the FAQ and nothing has helped solve it. To note nothing has changed on our network since it was last working to now so no updates to clients no policy changes no adfs changes etc. through the appdata log these are our errors. ERROR | IE Zone 3 protectedmode is enabled through… Read more »

trackback

[…] OneDriveMapper […]

Tim
Tim
1 year ago

I just wanted to put this out there. I was having an issue with several computers that sometimes could connect and other times wouldn’t. The logs showed “Failed to connect to…”. Turns out this is an issue with ISPs and resolving/routing IP6 addresses. If you run into this issue, disable IP6. This fixed all my issues. I don’t believe it has anything to do with this script, just the ISPs being used.

Last edited 1 year ago by Tim
Joe Morrow
Joe Morrow
1 year ago

I am working on getting my users up and going on version v5.10. The script works for me, but I have some concerns about the MSEdge Windows opening and closing. I am afraid that my users will close the Windows as they can be impatient at times. Is there a way hide the MSEdge windows opening?

Jesse
Jesse
1 year ago

Hi Jos, after last weekend our version 3.12 script stopped functioning. I was working on updating our system to use v5.10 but I can’t seem to get it to work. When the script launches, MSEdge opens with google.com in an app window (without an address bar) and it hangs here and does not succeed. I have tried different versions of the WebDriver.dll and this seems to change the behavior but it still does not work. Do you have any ideas about what I could be missing? The error log is: ERROR | Failed to load Edge driver, cannot continue. error details:… Read more »

Mike
Mike
1 year ago

Trying to use the 5.10 version of the OneDrive Mapper and getting the following errors. Any help would be greatly appreciated: Unable to connect to the remote server ERROR | Failed to load Edge driver, cannot continue. error details: Exception calling “.ctor” with “2” argument(s): “Cannot start the driver service on http://localhost:30178/” You cannot call a method on a null-valued expression. At C:\Program Files\OneDriveMapper\OneDriveMapper.ps1:629 char:5 +   $global:edgeDriver.Quit() +   ~~~~~~~~~~~~~~~~~~~~~~~~~   + CategoryInfo     : InvalidOperation: (:) [], RuntimeException   + FullyQualifiedErrorId : InvokeMethodOnNull   ERROR | Failed to cache Edge Window Handles Cannot bind argument to parameter ‘Id’ because it is null. ERROR | Failed to browse… Read more »

Tommy
Tommy
4 years ago

Anyone else getting error 59 or 53 the last few weeks?
Microsoft must have limited something after the huge increase in Teams usage.

sven
sven
4 years ago

Hi all
OneDriveMapper cann login with sso, see the website goes open and i see my files but the this error apears :failed to contact X: after mapping it to \\ourtenant-my.sharepoint.com@SSL\xxxx_xxxxx_xxxxx_xx\Documents, check if the URL is valid. Error:
Systemfailure 224 add to trusted sites. But when i check via PS all sites are in the trusted zone. Any Idea?
Thanks Sven

Ben
Ben
4 years ago

Thought I’d just mentioned that I’m redirecting the desktop, but instead of using the restart explorer function, I’m issuing a refresh of the desktop.

code:
Add-Type -MemberDefinition $code -Namespace WinAPI -Name Explorer
[WinAPI.Explorer]::Refresh()

It works reliably and is a nicer experience than restarting explorer.

SThurston
SThurston
5 years ago

We successfully mapped drive using the $adsfSmartLink setting set to “https://login.microsoftonline.com/login.srf?wa=wsignin1.0&whr=my.company.domain&wreply=https://mycomp-my.sharepoint.com&LoginOptions=1” where my.company.domain and mycomp are replaced with your values. I had been unable to map it before as I was never getting the Stay Signed In box in the browser.

Pradzy
Pradzy
5 years ago

Here is a good bat code to use to execute the PS1 script for the above mapper

@echo off
net use x: /del
PowerShell -NoProfile -ExecutionPolicy Bypass -Command “yourpath\OneDriveMapper.ps1”

Emalf13
Emalf13
5 years ago

Great work with this. Thanks.

I have gotten version 3.14 working. Much faster and smoother than 3.13.

However, I am having issues with the Folder Redirection. All work except for the Downloads folder. This keeps insisting on redirecting to the local PC. The downloads folder in the registry is named the same as the SID {374DE290-123F-4565-9164-39C4925E467B} rather than Downloads or MyDownloads. This is present in the GUID’s ($KnownFolders), and ‘Downloads’ is in Set-KnownFolderPath. But NOT in Get-KnownFolderPath. I have tried adding this as Downloads and the SID’s but to no avail.

Any ideas please?

Simon
Simon
6 years ago

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
Handun
6 years ago

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
Mickael Selander
6 years ago

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?

Tom
Tom
7 years ago

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
7 years ago

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?

Kevin De Schrijver
Kevin De Schrijver
7 years ago

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

trackback

[…] OneDriveMapper […]

Márton Bacsó
Márton Bacsó
7 years ago

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
Trond
7 years ago

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.… Read more »

Frank
Frank
2 months ago

Hi
This happend today when mapping favorited sites: ( Using v3.29 ). Is microsoft blocking somthing again? :/
INFO | A drive label has been specified, attempting to set the label for T:
INFO | Label has been set to Teams
INFO | Retrieving favorited sites because autoMapFavoriteSites is set to TRUE
INFO | Detected a id_token redirect, following…
ERROR | error retrieving favorited sites Exception calling “GetResponse” with “0” argument(s): “The remote server returned the error (400) Invalid request.”
INFO | Detected a id_token redirect, following…

Thomas Bøge
4 months ago

I’ve changed from v. 4.07 to 5.15 recently, primarily to use the new feature, hiding Edge by setting $forceHideEdge=$True. It worked for a week or two, but recently OneDriverMapper fails to sign the user in. It fails often, but not every time. If I set $forceHideEdge=$False, everything works – and it seemes to work every time. The fileversion of msedgedriver.exe is 120.0.2210.61 (dated 2023.12.07) and the fileversion of WebDriver.dll is 4.0.0.0 (dated 2023-11-09) This is the relevant output from the script, when it fails INFO | Your Edge version and Edge Driver version match INFO | Edge driver present and not… Read more »

SomeUser
SomeUser
4 months ago

Hey there,

want to say thank you for your work. Its help me a loot.
So again Thanks

Tammie
Tammie
5 months ago

Have been using this since its inception. Fantastic job! We are now installing via Autopilot and Windows 11. Only question is: is there a way to hide Windows 11 terminal after done mapping? Works fine on 10 Autopilot

Win11.PNG
Mahesh
Mahesh
6 months ago

V.5
Getting error
10/02/2023 13:21:50 | ERROR | Failed to get the username while at , aborting
10/02/2023 13:21:50 | INFO | Detected user: 
10/02/2023 13:21:50 | INFO | Onedrive cookie generated
10/02/2023 13:21:50 | INFO | Initiating Sharepoint session with: https://Org-my.sharepoint.com
10/02/2023 13:21:50 | INFO | Current location: 
10/02/2023 13:21:50 | INFO | Encountered a dialog, showing dialog to user

Stefan
Stefan
7 months ago

since a few days we have an issue with loading the edge driver
Failed to load Edge driver, cannot continue. error details: Ausnahme beim Aufrufen von “.ctor” mit 2 Argument(en): “The HTTP request to the remote WebDriver server for URL http://localhost:59007/session timed out after 60 seconds.”

George
George
10 months ago

v3.29 issues Had this script running perfectly for 24hrs and then randomly starts giving me; “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 or Internet Ex plorer needs a reset ERROR | failed to contact Z: after mapping it to \\OURCOMPANYSITE, check if the URL is valid. Error: System.Management.Automation.RemoteException System error 224 has occurred. System.Management.Automation.RemoteException Access Denied. Before opening files in this lo cation, you must first add the web site to your trusted sites list, browse to the web site, and… Read more »

trackback

[…] OneDriveMapper […]

Adrien
Adrien
11 months ago

Good morning Since yesterday morning we have a problem with OnedriveMapper we have the following error message and the script does not launch 05/03/2023 08:24:27 | ERROR | Failed to load Selenium driver, cannot continue! Error details: Exception calling ‘Load’ with ‘1’ argument(s): ‘Unable to load file or assembly ‘291285 bytes loaded from EdrDotNet, Version=94.0.0.0, Culture=neutral, PublicKeyToken =da1b3922653ea916’ or one of its dependencies. Attempt to load an incorrectly formatted program. » We have to delete webdriver.dll from the folder where the script is stored and in the user profile c$\Users\firstname.lastname\AppData\Roaming and restart the script for it to work Do you… Read more »

Rob Etech
Rob Etech
11 months ago

Hi
new script does not map drive but say the following

A drive label has been specified, attempting to set the label for M:
INFO | Label has been set to ***********
INFO | M: mapped successfully

if the M drive was there it removes it
if i use net use \\sharpointdriveURL it then maps ok

Tony
Tony
1 year ago

Does the script support Windows 11? I tried and it doesn’t work. Thank you!

Andy
Andy
1 year ago

since updating the webdriver.dll in 5.13 I get the following errors 02/28/2023 10:41:47 | INFO | Discovered Edge driver v110.0.1587.57 at \\profiles\UserProfiles$\andy.powell\AppData\Roaming\msedgedriver.exe 02/28/2023 10:41:47 | INFO | Edge driver present and not blocked by zoning, loading… 02/28/2023 10:41:52 | ERROR | Failed to load Edge driver, cannot continue. error details: Exception calling “.ctor” with “2” argument(s): “unknown error: Microsoft Edge failed to start: crashed.  (chrome not reachable)  (The process started from msedge location C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe is no longer running, so msedgedriver is assuming that msedge has crashed.)” 02/28/2023 10:41:52 | ERROR | Failed to browse to the Office 365 Sign… Read more »

Ted
Ted
1 year ago

30 plus users are getting this error. Was working yesterday. Believe it has something to do with IE 11 finally gone. Any help would be appreciated. The majority has KB5022834 installed. Removed, restarted to no avail. Users who have not rebooted computers this week are fine

System error 224 has occurred. System.Management.Automation.RemoteException 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. System.Management.Automation.RemoteException

trackback

[…] OneDriveMapper […]

Victoria
Victoria
1 year ago

I don’t know if just I had this problem… my MFA asks for a number at the cellphone app during handleMFARequest. So at the try block I had to add, before $ctx =$result.Ctx the following Quick&Dirty:

$MFAEntropy = $result.Entropy
        [System.Windows.Forms.MessageBox]::Show("Please enter this number in your MFA Authenticator: " + $MFAEntropy, "MFA Authenticator") 

Did I miss anything? 

Thanks for your solution!

Alex
Alex
1 year ago

In case any one else came across this issue. I found with running the MS Edge version on a Windows Server 2019 terminal server, IE uninstalled. Trusted sites needs to be added in this reg path “HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\EscDomains” Note this is ‘EscDomains’ and not just ‘Domains’

trackback

[…] OneDriveMapper […]

Ryan
Ryan
1 year ago

Love this script and when working its been great for us ! Great Work Jos Im getting issues with the script not using the correct 365 user im getting the below prompt, the second user is purely an email account within outlook yet it keeps adding itself to windows as a “Connected to Windows” account, Any thoughts ? or a way of telling the script to use the primary user ? Im trying to run it as a startup script and this prompt isn’t being shown to the user so it isn’t working correctly, when run manually it is fine… Read more »

odm.png
Ash
Ash
1 year ago

Anyone seen an issue where after a couple of hours the one drive mapping turns into a disconnected state. If you try to click on the drive you get a message then that you have to add the site to trusted sites.

Rasmus Ertmann
Rasmus Ertmann
1 year ago

Hi There. Just wanted to share a quick fix I found, when changing usernames. We are running V5. After changing UPN on a user, the script failed to run and giving out multiple errors, including loading the edge driver. I tried logout/logon on edge and deleting the edge driver but that did nothing. I discovered deleting the folder “Lieben Consulting” in AppData, and running the script again, solved the issue. This only happened on one device, and not on other devices where the UPN of the users were also changed. On the other devices it ran just fine, so it… Read more »

Jairon Junior
Jairon Junior
1 year ago

Hey there, First of all would like to thank you for this script, is being used for years here, I’m very much of a newbie on this field, so I just started using powershell etc, I updated the script here to 3.22 and so far is working normally, but I was trying to implement the 5.13 version and it worked on my computer, but on a fresh started win10 that is on the domain is getting the errors on the image below, I’m running it directly from the documents folder, also, it only occurs in the first try, If I… Read more »

Erro script.jpg
Mike
Mike
1 year ago

Using the latest 5.13 version of the script and getting the error below: ERROR | Failed to load Edge driver, cannot continue. error details: Exception calling “.ctor” with “2” argument(s): “Cannot start the driver service on http://localhost:20348/” This works on my local Windows 11 machine, but does not work on Windows server 2016 or 2019 virtual machines. We have tried this on a domain joined and non-domain joined Windows Server VM (to rule out GPO). We have also confirmed that this is not a firewall issue. We are stuck and would appreciate if you could confirm if you are able to… Read more »

Ryan
Ryan
1 year ago

Got this working for a few users however, doesn’t seem happy with a couple of users who have sharedmailbox accounts logged into outlook, it has shown a logon screen a couple of times with both the users account and the shared mailbox, anyway to specify to use the logged on user ?

Lorenzo Orlandi
Lorenzo Orlandi
1 year ago

Hello, I have an issue actually running the script on a terminal server:

ERROR | Failed to load Edge driver, cannot continue. error details: Method invocation failed because [OpenQA.Selenium.Edge.EdgeOption
s] does not contain a method named ‘AddAdditionalCapability’.
You cannot call a method on a null-valued expression.
At […..]\OneDrive\OneDriveMapper_5_011.ps1:629 char:5
+   $global:edgeDriver.Quit()
+   ~~~~~~~~~~~~~~~~~~~~~~~~~
  + CategoryInfo     : InvalidOperation: (:) [], RuntimeException
  + FullyQualifiedErrorId : InvokeMethodOnNull

I tried to search “addAdditionnalCapability” error was linked but no success.

This error appear after the msedgedriver.exe process is started

Do you have any idea that can helo me on this issue ?

Ryan
Ryan
1 year ago

Trying to get this to run on AAD machines via intune how do I do this ?

JezBurger
JezBurger
1 year ago

Really stumped on this one if I could get assistance from the experts with no mapped drives! Deploying a new Windows AVD host server with the following spec into a server farm with another 3 x AVD servers all working fine with OneDriveMapper 5.09: Edition Windows 10 Enterprise for Virtual Desktops Version 21H2 S build 19044.2132 Have got the same group policies in place for this new server to ensure the WebDAV requirements and everything is as per the requirements. Keep getting the following errors as noted in the log file with no drive mapping. If I attempt to manually… Read more »

Bernard Koops
Bernard Koops
1 year ago

Running it now for a couple of weeks and implementing it step by step for departments having software (financial, customs…) which still cry out for ‘drives’ to upload data. So far, so good! Getting more happy with it by the day.

Found by trial and error you can use more than 1 group in one line by simply adding an ‘s’ making the following:
“mapOnlyForSpecificGroups“=”Group_1″,”Group_2″,”Group_3”
Personally not much of a programmer, but good steal is better than a bad write 😉

Austin
Austin
1 year ago

Anyone know of a way to map subfolder instead? Adjusting the URL doesn’t seem to work, it seems to only want to map it with .ASPX at the end?

Martin Curtsen
Martin Curtsen
1 year ago

i’ve got a problem with ver 5.11
i has been running on the client pc, but stopped working today
i get this error
i’ve deleted all cookis, but i still get the error

ERROR | Failed to set a cookie: Exception calling “SetWinINETCookieString” with “3” argument(s): “Exception setting cookie: Win32 Error code=4317”

and end with this error
System.Management.Automation.RemoteException Systemfejlen 224 opstod

Bernard Koops
Bernard Koops
1 year ago

Really nice script. Not all options explored yet, but so far doing what we need. Put it in GPO, added at start next 3 lines to make it fully ‘invisible’ (not mine, credit to an old post on Stackoverflow)
$t = ‘[DllImport(“user32.dll”)] public static extern bool ShowWindow(int handle, int state);’
add-type -name win -member $t -namespace native
[native.win]::ShowWindow(([System.Diagnostics.Process]::GetCurrentProcess() | Get-Process).MainWindowHandle, 0)

Zenna Willemsen
Zenna Willemsen
1 year ago

Hello everyone, I have an issue with the latest Onedrivemapper version. Users in our tenant are not allowed to install the latest edge driver. This is what I can find in the logfile: 09/15/2022 09:31:35 | ERROR | Failed to load Edge driver, cannot continue. error details: Cannot remove item C:\Program Files (x86)\Scripts\OneDriveMapper\Driver_Notes\credits.html: Toegang tot het pad is geweigerd. Currently we have a workarround for this problem as we manually update te Edge driver. However since Edge often get updates we want this option to work so the script automatically get the right version. We don’t want to change the permissions… Read more »

Onedrivemapper foutmelding.png
Mike Hussey
1 year ago

Having two serperate issues on differnet machines – i have successfully mapped two multiple machines but a handful of machines are displaying different errors 1 attached below, 2 is “failed to browse to the office 365 sign in page, error exception calling ‘gotourl’ with ‘1’ argument: HTTP requests to remote webdriver times out after 60 seconds” – Previously using V3 currently using V5

v5 Issue 2.png
FAVIER JOEL
FAVIER JOEL
1 year ago

Thank you A LOT for this script !

Nick
Nick
1 year ago

When running the v5 version we receive the following. Edge starts with a brower without searchbar then stops. ERROR | Failed to load Edge driver, cannot continue. error details: Exception calling “.ctor” with “2” argument(s): “invalid argument: user data directory is already in use, please specify a unique value for –user-data-dir argument, or don’t use –user-data-dir” ERROR | Failed to browse to the Office 365 Sign in page, this is a fatal error You cannot call a method on a null-valued expression. (we are updating because v4.11 has the following: Mapping cannot continue because we could not log in to Office… Read more »

trackback

[…] Voici une l’alternative que j’utilise souvent en entreprise qui permettra de mapper des lecteurs réseaux et plus:https://www.lieben.nu/liebensraum/onedrivemapper/ […]

A.D.
A.D.
1 year ago

Just a small modification to your OneDriveMapper v.5.10:
I have added “$global:edgeOptions.addArguments(“headless”)” – in my environment it hides the window and resolves the to-do item that was left without throwing any errors.

Ted
Ted
1 year ago

Log files shows that drive maped correctly yet does not show up.

08/17/2022 07:46:10 | INFO | J: mapped successfully

The only error in log is below

08/17/2022 07:46:01 | ERROR | Failed to cache Edge Window Handles Cannot bind argument to parameter ‘Id’ because it is null.

Only happens to 2 users out of 40 mapped. Concern as both were just recently

Fabrice Paccou
Fabrice Paccou
1 year ago

With the version 3.21, I was able to map a drive letter and access to all my favorites sharepoint site. However, now we must use the latest version since something seem to have change on Microsoft side last weekend I guess. I am trying to configure this way. However, it give me error : ERROR | failed to add network location: Error while creating shortcut @ “R:\Teams\target.lnk”. Check your access and permissions Here’s what I configured in the section starting at line #34 {“displayName”=”Teams”;”targetLocationType”=”converged”;”targetLocationPath”=”R:”;”sourceLocationPath”=”https://TENANTNAME.sharepoint.com/_layouts/15/sharepoint.aspx?v=following”;”mapOnlyForSpecificGroup”=””} Does someone has been able to map a drive directly to access to all favorites ?… Read more »

James Barker
James Barker
1 year ago

We have been using OneDrive Mapper for the past Five Years, so thank you very much.

We are now using Version 5 and mapping Sharepoint Sites & Onedrive,

Unfortunately we have an issue the script sometimes fails to connect, We launch the script using a shortcut via the start menu.

If we then run the shortcut again manually it maps the drives !!!

This is very frustrating as we cannot find the issue..

Elton Farias
Elton Farias
1 year ago

Friend I need your help.
In version 5, how do I bypass the call to test connection (AuthCheck() function) and only load the OneDrive authentication screen?

The idea is to call the OneDrive authentication screen directly as the first call ok.

Last edited 1 year ago by Elton Farias
Creak
Creak
1 year ago

Hi Jos, we are testing v5.10 but it seems like it requires users to sign in to Microsoft accounts with their e-mail and password. It’s not an issue with v3 as OneDrive can be mapped automatically without sinning in. 

Kaushik Patel
Kaushik Patel
1 year ago

Hi, im getting the following below, even tho nothing has changed from trusted sites and KB i have also done a IE Reset too This is using 4.08 can you please advise what shall i do next 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 or Internet Explorer needs a reset ERROR | failed to contact X: after mapping it to \\*-my.sharepoint.com@SSL\DavWWWRoot\personal\*_*_*_*_*\Documents, check if the URL is valid. Error: Access Denied. Before opening files in this location, you must first add the… Read more »

Mike
Mike
1 year ago

We were unable to get v5.10 of the script to work due to this error: You cannot call a method on a null-valued expression”.

As a workaround we are trying to v4.08 script. This appears to work ok, but we get the following error:

convertfrom-json : Invalid JSON primitive: ul.
At C:\Program Files\SharePointDriveMapper\SharePointDriveMapELP1-4.08.ps1:1486 char:115
+ … artJson,($endJson-$startJson-4)).Replace(‘\”‘,'”‘) | convertfrom-json
+                             ~~~~~~~~~~~~~~~~
  + CategoryInfo     : NotSpecified: (:) [ConvertFrom-Json], ArgumentException
  + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand

mark
mark
1 year ago

Hi Jos, Mark here again with a different issue that just appeared today. We’ve been using 3.19 on servers with native auth. It’s been working great for years now. Suddenly, today we are getting errors on numerous servers either asking for passwords or failing with the error ‘cant logon to office 365’. We get this error: ERROR | Unable to find user realm due to Exception calling “GetResponse” with “0” argument(s): “The remote server returned an error: ( 403) Forbidden.” ERROR | fallback mode is enabled, and login failed. Attempting IE auth mode… Then it fails on the IE auth… Read more »

Adrien
Adrien
1 year ago

hello,
We have implemented version 5 of Onedrive mapper on our IT equipment.
The problem is that on 3 PCs, we have the onedrive mapper script which restarts in a loop. do you have an idea?
Thanks

Martin Curtsen
Martin Curtsen
1 year ago

i’ve got an issue with version 5.10
i get his error
 Failed to set a cookie: Exception calling “SetWinINETCookieString” with “3” argument(s): “Exception setting cookie: Win32 Error code=4317”

Alfredinho
Alfredinho
1 year ago

I get the following error.

System.Management.Automation.RemoteException
ERROR | autoRemapMethod is set to Path, but all mappings failed, OnedriveMapper will exit

The mapping works on all workstations except 1.

René
René
1 year ago

Hallo Jos,
i have a problem with v4.07.
it runs and it connect the drives and then its done and works. but then the script is going to run again and again and again. v3 did not had this do you know what it could be?

Ted
Ted
2 years ago

Newest version works on 10, have issues with 11 as get this error

Downloading latest version from https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver/97.0.1072.76 98.0.1108.43/edgedriver_win64.zip to C:\Program Files (x86)\********\****** and ***Program Directory*** ( edited for privacy)
02/24/2022 12:24:51 | ERROR | Failed to load Edge driver, cannot continue. error details: BlobNotFoundThe specified blob does not exist.
RequestId:d565d71b-201e-00d8-05ab-294ad3000000

Something need to change? ( prefer not to stop Edge update)

Martin Curtsen
Martin Curtsen
2 years ago

the autoupdate i 5.8 fails with this message

Failed to load Edge driver, cannot continue. error details: Exception calling “.ctor” with “2” argument(s): “session not created: This version of MSEdgeDriver only supports MSEdge version 96
Current browser version is 98.0.1108.50 with binary path C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe (SessionNotCreated)”

If i download and install the latest version maually everything works again

Julien
Julien
2 years ago

Hello Jos, it seems that there is a download size limit of 5Mb on the sharepoint drive if we want to copy files locally. Is there a way to modify this limit ?

Thanks a lot.

Jonathan
Jonathan
2 years ago

Hi,
I can’t seem to run this script without admin rights. As an admin it works like a charm.
Which access does a normal user need to have, in order to get this script run?

xbonet
xbonet
2 years ago

Hello,

We were using the script and it does the job perfectly. But a couple days ago, we enabled the “Windows Authentication” in our ADFS and now we get an error similar to “failed to contact S:\ after mapping it to \\companyname.sharepoint.com….” and the drives are not mapped.

We tried disabling that feature during a few minutes and it worked again. Any tips?

Greetings!

shawn
shawn
2 years ago

Hello, when we use the v5 script in our logon process, the users see two instances of Edge starting and closing. Is this expected behavior? If so, is there a way we can hide that from the users?

Mon Sam
Mon Sam
2 years ago

Thank you for the script. While the script works perfectly fine behind a firewall, when executed externally I am faced with a problem where the script stops and shows that it is “Attempting to detect username at https://login.microsoftonline.com/login.srf?msafed=0“. I found that if I do a “runas” and then enter my credentials the script will then successfully map my drive.

i.e.  runas /user:texas\<username> notepad

While I do not believe it has to do anything your script, whereas it may be something with my Azure setup, I was curious if you have encountered such issue.

Microsoft 365, Azure, Automation & Code

2.4K
0
Would love your thoughts, please comment.x
()
x