OneDriveMapper

onedrivemapperOneDriveMapper is a free, open source script I wrote which you can use 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 500,000 times, has millions of users 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.

Download open source version:

OnedriveMapper V3 / older releases (does not support all types of MFA, conditional access etc but has more features)

OnedriveMapper v4 latest (very lightweight and simple version that supports all kinds of MFA)

Enterprise alternative (with support & discount):

IAM Cloud Drive Mapper

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.

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 forgiving technology.

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

Requirements

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

Recommendations

How to install

  1. Download the latest version at GitLab
  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)
  6. Set $O365CustomerName to your Tenant Name (xxx.onmicrosoft.com)
  7. disable file locking
  8. Run it on a representative test machine / user and thoroughly check the log it generates in %APPDATA%
  9. 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

  • 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

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.

2070 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Ian
Ian
2 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.

trackback

[…] OneDriveMapper […]

Edwin
2 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
3 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.

Alan
Alan
2 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
3 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 »

Vrajes
Vrajes
1 year 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 »

Bill Hixon
2 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?

Andy
Andy
2 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.

Albert
2 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 »

Sam
Sam
3 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 »

Jason
Jason
2 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?

John
John
2 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 […]

Kevin De Schrijver
Kevin De Schrijver
3 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.

Tommy
Tommy
8 months 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
1 year 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

Richard
Richard
1 year ago

Onedrivemapper only maps drives when you manually ‘open in explorer’ the onedrive/sharepoint library. Is this by design or could it be as i am used Okta as SSO. Can this be scripted to automatically open in explorer.

Ben
Ben
1 year 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
2 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
2 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
2 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?

Mike
Mike
2 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

Emil Sandberg Lyngved
3 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 »

Simon
Simon
3 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
3 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
3 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
3 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
3 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
3 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ó
4 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
4 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 »

trackback

[…] OneDriveMapper […]

Scott
Scott
9 hours ago

Started to receive the following error. “check if the URL is valid. Error: System.Management.Automation.RemoteException System error 59 has occurred. System.Management.Automation.RemoteException An unexpected network error occurred. System.Management.Automation.RemoteException”.

I am using v3.21, which has worked flawlessly until today. I have not applied any windows updates or changed GPO settings.

To try to remedy, I have tried to use v4.07, but it says that I’m already logged in (doesn’t prompt me for password) and still gives me the same exact error. What should I look for? I have removed all cache, cleared cookies.

Johnmy Rivera
Johnmy Rivera
1 day ago

How do I get the script to only map the drive if the user is part of the target security group?

Right now the script maps all the sites under desired mappings.

Ralph Montgomery
1 day ago

Love the script; using the lightweight version (4.07) appears to have solved the issue of mapping an F3 user’s OneDrive, but has dropped support for automapping the Teams/SharePoint Favorites functionality (present in v3.20); something we would like to pursue. What functions can we pull back into a customized version to add that back?

Karen
17 days ago

Hi,
Version 4 on Domain Joined devices not recognizing User UPN and asking to login everytime when startup scrip runs.

For old version scrip $userLookupMode = 4 works without login process.

Any idea how we can add $userLookupMode = 4 on V4 script ?

Robert
Robert
29 days ago

I’m trying to use the 4.0.7 version. It’s working only i have the problem with automatic connect all my favorite teams. It wont work what i’m trying. Is there someone with a solution? Its about 3000 teams for different users.

mikel
mikel
1 month ago

Hi! I am getting the 224 error. I followed some advices in previous comments but I can’t manage to solve the problem. This is the log. Thanks in advance!!! 10/07/2020 17:28:26 | INFO | —–10/07/2020 17:28:26 OneDriveMapper v4.02 – user on SKV00021 starting—– 10/07/2020 17:28:26 | INFO | Script elevation level: User 10/07/2020 17:28:26 | INFO | Set TLS protocol version to prefer v1.2 10/07/2020 17:28:26 | INFO | You are user running on Windows 10 with IE 11 and Powershell version 5 10/07/2020 17:28:28 | INFO | NOTICE: IE Security zones ambiguous – checking both computer and user 10/07/2020… Read more »

Kaushik Patel
Kaushik Patel
1 month ago

Hi All,

Im getting the following error
Error deteched while following fmHF redirect, check the FAQ for help
fallback mode is enabled, and login failed. attempting IE auth mode…

does anyone know how to fix this.

jay
jay
2 months ago

It mapped the drive for me. I got to the point where it says “sleeping for 39 seconds”. It froze after that.
It also says “autoprotectmode is set to true, reverting to old settings” not sure what that means. Is it going to reset my KFM settings? I have my Documents, Pictures and Desktop syncing to OneDrive.

Last edited 2 months ago by jay
martin
2 months ago

i’ve got some problems since monday
the mapped drives look empty
if we update the folder it sometimes comes back
the folder are also working extremly slow

RICHIOUD
RICHIOUD
2 months ago

Hello Jos,

This day i speak with Microsoft about slowness and problem with displaying Folders and Files in mapped drives. They said me : “IE will be shut down on November 30”, after that can we continue to use mapped drives ?

Cordially,

RICHIOUD Jérémy

AEmberson
AEmberson
2 months ago

New version 4.3 the first time is asking my users to sign in via the internet and brining up the MS sign in page. Never used to do this with V3. Any ideas?

Joshua
Joshua
2 months ago

Hi Jos,

First of all, thank you so much! This script is amazing! It is working with Server 2019 with Citrix 2006 MSC. You are the best!

DawnM
DawnM
2 months ago

I recently mapped my OneDrive using the latest, v4, of the mapper. Now when I try to refresh in IE, it’s not refreshing the mapped folder in File Explorer. I still get the “an error occurred while reconnecting…” message. I didn’t have an issue with refreshing through IE when an older version of the mapping script had been used. How can I resolve this without re-mapping my drive every time it disconnects? Thanks.

Massimo
Massimo
6 months ago

Does version 4 works if Internet Explorer is not installed?

Version 3 did, but now I get the error “Mapping cannot continue because we could not start your browser”

OnedrivemapperErrorNoIE.png
paul Digi
paul Digi
9 months ago

I have a problem after changing the password of my mail account i can’t login. Where does onedrivemapper store the login

Johnathan Joynson
Johnathan Joynson
10 months ago

Hi, I can use the mapper to map one drive, but if I to do two I get: INFO | Initiating Sharepoint session with: https://xxx.sharepoint.com/sites/Shared%20Documents/Forms/AllItems.aspx/xxx INFO | Retrieving Sharepoint cookie step 1… ERROR | Failed to retrieve cookie for SpO, will not map this site: Exception calling “GetResponse” with “0” argument(s): “The remote server returned an error: (404) Not Found.” INFO | Initiating Sharepoint session with: https://xxx.sharepoint.com/sites/Shared%20Documents/Forms/AllItems.aspx/Account_Share INFO | Retrieving Sharepoint cookie step 1… ERROR | Failed to retrieve cookie for SpO, will not map this site: Exception calling “GetResponse” with “0” argument(s): “The remote server returned an error: (404)… Read more »

Leo
Leo
10 months ago

Hello

I have a question
We using MFA coming from our adfs and when i go to office365 then i get mfa that works good
but if a run the onedrive script 3.21 then i get no popup to put MFA code to connect with office 365 onedrive map

Can anybody help me to put my in the right direction ?

Thanks for the help

Ziad Mustafa
Ziad Mustafa
11 months ago

Hello,

I tried running the script many times with no success. I tried tweaking/troubleshooting it but I keep getting the following:

ERROR | Failed to find the correct controls at https://login.microsoftonline.com/login.srf?msafed=0 to log in by script, check your browser and proxy settings or check for an update of this script or switch to Native mode. The element i0116 was not found (2) or had no tagName
ERROR | IE auth login mode failed, aborting script

Any ideas, thoughts, and/or input would be greatly appreciated!!!

Thanks,

weba
weba
11 months ago

Lately seen random issues where the script does not work and prompts user for an password. First error (of many) is this: Failed to find signin element type 1 on Office 365 login page. Error details: The element otherTileText was not found (2) or had no tagName

This only appears once in a while, for now at least…

Magne Stenwig
Magne Stenwig
1 year ago

Thank you for a fantastic script!

I am trying to map to a Sharepoint-site where I am a guest. I have the permissions needed to log on as a guest via web, but I have not been able to use Onedrivemapper to map the doclib.

Do you know if this is possible?

Best Regards
Magne

sven
sven
1 year ago

With Server2016 i had this error:

282/5000
System error 224 occurred.
The access was denied. Before you open files in this location, you must first add the site to the list of trusted sites. Then you need to access the website and select the option to automatically log in.

But when i check with powershell it is in :
ttps://ictedubs.onmicrosoft.com : 1
https://autologon.microsoftazuread-sso.com : 1
https://aadg.windows.net.nsatc.net : 1
https://*.microsoftonline.com : 2
https://ictedubs-my.sharepoint.com : 2
https://ictedubs.sharepoint.com : 2
\\ictedubs-my.sharepoint.com@SSL\DavWWWRoot\personal\* : 2
\\ictedubs-my.sharepoint.com@SSL\* : 2

Any Idea?

Thanks Sven

Jason Connors
Jason Connors
1 year ago

Hello,

Is anyone still actively using this script? If not,anyone still following this thread that has a recommendation?

Thank You,

chaddie
chaddie
1 year ago

OneDriveMapper stopped working recently. Has anyone figured out a fix for this?

MdB
MdB
1 year ago

After spending the last few days troubleshooting the error beneath, i checked if i was using the most recent version of the script (3.20). After downloading the script again i noticed the version is 3.19. The personal OneDrive folder was being mapped fine, any subsite returned this 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. I tried the following in version 3.20: – Added GPO with Logon option ‘internet explorer… Read more »

Martin
Martin
1 year ago

i get error 53 site not found, but only on some computers
if i run the same script on another computer i works

Reece
Reece
1 year ago

Hi, we are looking to enable SSO but not azure domain everything. Just SSO account. will this work with the mapper under azure? we want students to log in, script to run and pick up the office 365 areas we link to it

https://docs.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-sso-quick-start

thanks!

Mark
Mark
1 year ago

Hello,
I really like what you have accomplished with your powershell script and drive mapper code.

Within our organization, users do not tend to log off, so what happens is that the authentication cookie expires.

To get around this problem, I would like to schedule a task to run the OneDriveMapper every 24 hours.

However, I cannot get the script to execute properly through the task scheduler. Task scheduler does not like mapping drives.

Do you know of a way to resolve this issue?

Thanks!

Mark

Mike
Mike
1 year ago

We have been using this successfully for years. We have found that the connection drops when trying to open a PDF through the mapped drive. Any throughts on what i need to do to get this fixed?

german
german
1 year ago

Hi Jos, Is it possible to add on the script the option to map the “Shared with me” to a drive letter?

Nathan
Nathan
1 year ago

The mapping works fine but folder redirection always throws this error;
INFO | Redirecting Desktop to o:\Desktop
ERROR | Failed to redirect to : Error redirecting Desktop. Return code -2147024891 = Access is denied
INFO | Redirecting MyDocuments to o:\Documents
ERROR | Failed to redirect to : Error redirecting Documents. Return code -2147024891 = Access is denied
INFO | Redirecting MyPictures to o:\My Pictures
ERROR | Failed to redirect to : Error redirecting Pictures. Return code -2147024891 = Access is denied

It creates the empty folders on O drive but doesn’t redirect. Version 3.20 . Any ideas?

Vijay
Vijay
1 year ago

We are testing the script on Windows Server 2008 R2(Windows 6) and received the error 1790 and unable to map the OneDrive with the local drive, have enabled & configured WebDAV from the feature option and but still no luck.

Any idea?

Antonio
1 year ago

Hello Jos/ Everyone,
thank you for this great script… as many users i had a lots of issue if deployed with GPO.
Tried several ways but none of them was stable. we sorted out this issue by developing a simple .exe that pick up the script from an https url and execute it.

BR,
Antonio

Gopinath Ganesan
Gopinath Ganesan
1 year ago

Hello Jos/ Everyone,

Im getting the following error message suddenly and it stopped working, it was working very smooth, Im using OKTA single sign on for Office 365 federation. Any kind of help greatly appreciated.

05/28/2019 17:04:16 | ERROR | Failed to find the correct controls at https://“” to log in by script, check your browser and proxy settings or check for an update of this script or switch to Native mode. The element i0116 was not found (2) or had no tagName
05/28/2019 17:04:16 | ERROR | IE auth login mode failed, aborting script

Thank you,
Gopinath Ganesan

Samer Sultan
1 year ago

What line in the code do we add trusted sites to?

Curtsen
Curtsen
1 year ago

i keep getting this error in version 3.20
tried different pc and profile but same error
ERROR | Error detected while following id_token redirect, check the FAQ for help
INFO | Mapping target: \\jtlifting.sharepoint.com@SSL\DavWWWRoot\sites\Kontor\Delte dokumenter
ERROR | failed to contact K: after mapping it to \\jtlifting.sharepoint.com@SSL\DavWWWRoot\sites\Kontor\Delte dokumenter, check if the URL is valid. Error:
Systemfejlen 224 opstod.
Adgang n‘gtet. Inden du †bner filer p† denne placering, skal du f›je webstedet til listen over websteder, du har tillid til, g† til webstedet og v‘lge at logge p† automatisk.

Rebecca DiFede
Rebecca DiFede
1 year ago

I’ve been using OneDriveMapper for awhile with no issues, but recently (last month or so) it stopped mapping drives when users are logged into a VDI. The script runs, and it says that the drives have mapped successfully, but when you open the file explorer they’re not there. We’re using Citrix to access the VDI’s through a netscaler, and our Citrix server is on Windows 2016. Has anyone else experienced this?

Greg
Greg
1 year ago

The most recent version (3.21) doesn’t seem to work at all. It will not even attempt to log in. I also notice that the Team Site line is now removed, which makes me think this and the malfunction are not coincidental?

Mohammad Shaon
Mohammad Shaon
1 year ago

One driver mapper is not working.. i am not sure what is happening.
once the login to the office 365 was successful, following error was showing

Info Attempting to get the username at https://nygard-my.sharepoint.com/_layouts/15/MySite.aspx?MySiteRedirect=AllDocuments……..(run that line up to 62 sec)

Then showed log in failed……………please help me in this case

Andrew
Andrew
1 year ago

This script is still working great. Unfortunately we may have to start using a proxy server. I understand that turning off automatic proxy detection helps to speed up WebDAV connections, but will this script work properly through a proxy with the settings specified by, for example, Group Policy?

Tyson
Tyson
1 year ago

Jos,

Is this supposed to act as a full redirection?

One of my users does not see real-time when another user saves a document to the same SharePoint site. Additionally, many of my users cannot see any files in a particular folder. This folder does have hundreds, maybe even thousands of files. Do I need to increase the size limit or should they be able to see the files?

SVH
SVH
1 year ago

Hi Guys

Firstly thanks for a great script,, one issue is if i run the script manually it work but when running via gpo wont work,,, old script use to run fine have updated gpo to point to new script and nothing,, any pointers thanks in advance

Mohammad Shaon
Mohammad Shaon
1 year ago

I am having this issue while I am running this script

Method invocation failed because [System.Int32] does not contain a method named ‘IndexOf’.
At C:\Users\MOS\Downloads\v3.19.ps1:2078 char:16
+ if($nextURL.IndexOf(“https:”) -eq -1){
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound

Exception calling “Create” with “1” argument(s): “Invalid URI: The format of the URI could not be determined.”
At C:\Users\MOS\Downloads\v3.19.ps1:621 char:13
+ $request = [System.Net.WebRequest]::Create($url)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UriFormatException

Paul Clarke
Paul Clarke
1 year ago

Hi

I work in a school and we have been using your script just fine.

I have built a new windows image with Windows 10 1809 x64.

Exactly the same programs as our previous build of 1803 x64.

The script (v3.19) is now failing on these machines.

ERROR: Failed to set test cookie, script will fail: Exception calling “SetWinINETCookieString” with “3” argument(s): “Exception setting cookie: Win32 Error code=0”

So obviously the script then fails with error 224 later on.

I have set $autoResetIE to True

Trusted sites are all set up via GPO.

Dirk
Dirk
1 year ago

Great script, helps a lot!
I get a warning : Maximum file upload size is set to 48 MB
Can this changed somewhere?

Regards
Dirk

Andreas Olofsson
Andreas Olofsson
1 year ago

How should I configure the script when using conditional Access and do not require MFA for Azure Joined/ workplace joined devices.

The script works fine without the conditional access rule that requires MFA on not Azure AD joined devices.

On line 1848 in v. 3.19 a verification of the response Uri is to “https://login.microsoftonline.com” but the response is rederected to “https://device.login.microsoftonline.com”. It looks lite the script does not cope with this scenario.

Does anyone have any clue?

Johan
Johan
1 year ago

Hi, The script runs perfectly with no errors during logon in our Citrix environment. However,I am having an issue with the mapped drive being lost mid session after an unspecified amount of time. When this happens you can see the drive mapped in explorer, but with no bar to show disk usage, it says FAT32 formatted drive. When you try to open in you get a message saying Access denied, you need to add the location to your trusted sites before opening. I have seen people having this issue while running the script but nobody else seems to have this… Read more »

Hendra
Hendra
1 year ago

Hi Jos! thanks for the awesome scripts. v3.19 is working nicely. So far I monitor, the token will be expired within a day (assuming users do not logout from machine). I’m wondering if there any way we can do to keep/extend the token lifespan ?

Jon
Jon
1 year ago

Script seems to not work if you have configured AAD Terms of use (https://docs.microsoft.com/en-us/azure/active-directory/governance/active-directory-tou) that’s targeted at SharePoint Online. It does not matter if user has given consent before running script. Here is the log when TOU is applied: … INFO | Login succeeded INFO | Retrieving Onedrive for Business cookie step 1… INFO | Retrieving Sharepoint cookie step 2 at https://login.microsoftonline.com:443/federation/redirecttoexternalprovider INFO | Waited for 0 seconds for O4b auto provisioning… INFO | Waited for 10 seconds for O4b auto provisioning… … INFO | Waited for 180 seconds for O4b auto provisioning… ERROR | Failed to auto provision onedrive… Read more »

Randy B.
Randy B.
1 year ago

OneDrive Mapper not working with MFA enabled? SO I am testing MFA with Azure P1 and third party product. Now my One Drive mapper is no longer working.. the third party app support is telling me the one drive script doesn’t support “modern Authentication” whatever that is.. anyway I think I can get around it if I can figure out how to force the one drive mapper script to use a service account instead of using my account.. any tips or suggestions on how to modify it so that will work?

Tim
Tim
1 year ago

I have an issue for some machines whereby the script needs to run every day, otherwise the mapped drives are not accessible – the drives no longer connect and show as ‘FAT’ for some reason!

The drives are using letters on the far end of the alphabet so can’t see there being any conflict with any local devices.

Anyone know of a reason why this would happen?

Allan
1 year ago

Using v 3.19 and I get OnDrive to map successfully. However I can’t seem to get my SharePoint to map. Path is: https://mytennantname.sharepoint.com/hr/shared documents

I’m sure it’s a simple fix. Any help would be approeciated.

Tim
Tim
1 year ago

Hi, you mention ‘automatic mapping of sharepoint and teams sites’ in your description (implying this is available now, unless I read it wrong). Has anyone got this working yet? I can see it’s there (a OneDrive GPO) but doesn’t work for me and the roadmap suggests it’s not even launched yet! https://www.microsoft.com/en-us/microsoft-365/roadmap?filters=&searchterms=27031

Andrew Chapman
Andrew Chapman
2 years ago

Does the OneDriveMapper remove other mapped drives during login? We’ve been using it successfully for a long time now, but recently OneDriveMapper users have started complaining that some on premises mapped drives are not mapping correctly. These other drives are mapped using a batch file specified in the user’s AD logon script field. The batch file just contains a NET USER command. I’m speculating that the OneDriveMapper script is somehow interfering with this process.

Hampe
Hampe
2 years ago

Hi Jos, thanks a lot for this Script, really great.
Since a few days I try o run it on Windows Server 2019 but without success. Always the error: ERROR | Failed to set a cookie: Exception calling “SetWinINETCookieString” with “3” argument(s): “Exception setting cookie: Win32 Error code=0”.
Has sombody a running version on Winopws Server 2019 or can tell me what I need to change?
Regards

Matt
Matt
2 years ago

Hi,

I’m just doing some testing with MFA, we’re using app notification and all is well, my problem is when it comes to white listing IP’s. I’ve white listed our ISP on the O365 MFA settinsg, which works fine with logging in via the browser, but still the onedrive mapper requires an approval from the users phone. Will there be an update at some point which would resolve this?

sebus
sebus
2 years ago

INFO | MFA check result: Unsupported MFA method detected: PhoneAppOTP

James Ma
2 years ago

I am having issues with the script, it is set for native mode but revert to IE mode. All was well when not using mfa, but once mfa was activated for my account, I get error failed to get the username from url….

julienjb
julienjb
2 years ago

Hello,
anyone with “system error 59 has occured” ?

Cambo
Cambo
2 years ago

Hi Jos

I’m having difficulty redirecting Documents to the OneDrive location- the drive maps fine but we see this in the log:

10/17/2018 10:38:34 | INFO | Redirecting MyDocuments to G:\My Documents
10/17/2018 10:38:35 | ERROR | Failed to redirect to : Error redirecting Documents. Return code -2147024891 = Access is denied

Cambo
Cambo
2 years ago

I have a generic question about the WebDAV protocol if someone can shed some light.
By design, the WebDAV drive capacity is set to match the system drive because it can’t report the capacity of the remote drive. What happens if someone has a OneDrive content that exceeds the system drive? For example, if the system drive is 60GB, and a user with 100GB of OneDrive content logs in, will the system continue to write data to the OneDrive (WebDAV) location? Is this just a ‘reporting’ issue?

Christian
Christian
2 years ago

Hi,
how to get OneDrive working for administrative PowerShell?
For me the mounted device is only available for my user.
Windows 10 1801.

Thank you in advance

Dave
Dave
2 years ago

Hi,

I am trying to authentication using ADFS but I am getting the below message and password box popup.

Can anyone help?
Thanks
Dave

AA2
INFO | Contacting Federation server and attempting Single SignOn…
WARNING | Federation Services did not sign us in automatically, retrieving user credentials..
ERROR | Failed to retrieve user password from cache: Cannot find path ‘C:\Users\tstuser01\AppData\Roaming\OneDriveMapper.tmp’ because it does not exist.

Dave
Dave
2 years ago

Hi, Can anyone help with this message. We would like to authenticate users via ADFS but keeps prompting for a password.

Thanks
Dave

AA2
INFO | Contacting Federation server and attempting Single SignOn…
WARNING | Federation Services did not sign us in automatically, retrieving user credentials..
ERROR | Failed to retrieve user password from cache: Cannot find path ‘C:\Users\tstuser01\AppData\Roaming\OneDriveMapper.tmp’ because it does not exist.

Hendrik
Hendrik
2 years ago

Hello Jos, we use OneDriveMapper within our orgranisation. it works well, but sometimes after a few hours the sharepoint site is no longer open and users are notified * \ not accessible . any idea what the problem can be?

fastback
fastback
2 years ago

Hi, how to map “shared with me” folder?
I am always getting only my “personal files” folder mapped, but I would like to map also second folder which is shared with me with some specific permissions. Basically in this case each user, who want to map onedrive, should receive also shared with him folders with permissions set by admin in onedrive..
How can I do that?
Thanks in advance.

Office 365, Azure, Enterprise Mobility and DevOps

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