3

ive looked at several previous questions, but none have seemed to be exactly what im needing, or those questions themselves were never answered.

what i want is to have a batch file that users can run, and map their one drive for business library as a local network drive via net use. The reason we do not want to use the onedrive application, is because we are a health care provider, and we do not want PHI on laptops out in the field, so this would suffice. The E2 users could save documents directly from their OWA page and not have to download/upload the document that may or may not have PHI on it.

what ive tried is this, and this works on a domain computer but only if you have checked the "keep me signed in" box on the sharepoint login page. I guess it may be setting a variable that net use is grabbing? i dont know.

@ECHO OFF
SET /P Usrname=Enter username: 
net use O: https://mfh-my.sharepoint.com/personal/%Usrname%_domain_org/Documents

If i run this on a non domain pc running windows xp (yes they are still out there) or windows 7, it gets a "system error 67 has occurred". Ive tried adding the *.sharepoint.com to the trusted sites list as a fix, but that didnt work.

any other ideas as to why this is not working for non domain pc's? There has to be a way to give net use what it needs to add this path to onedrive. What else is there that a non domain pc may need in the net use command to get this done?

worried it might be a credential issue, ive also tried this, to no avail:

@ECHO OFF
SET domain=domain.org
SET /P Usrname=Enter username: 
net use O: https://mfh-my.sharepoint.com/personal/%Usrname%_domain_org/Documents * /USER:%domain%\%Usrname%

anyone have any other ideas?

1 Answer 1

0

The problem with mapping OneDrive for Business to a drive letter is renewing the authentication token. If its not renewed then the drive mapping will be dropped. To renew the token you need to automate Internet Explorer sign in so that the WebClient service, which uses WebDAV, will pick up the refreshed token.

There are Powershell scripts available from the community to do this for you. Here are a couple which allow you to customise the scripts to your needs:

If you would consider a commercial solution, then you could take a look at Zee Drive which manages the mappings and token renewal for you: Map network drives to OneDrive for Business and SharePoint Online document libraries - Reliably

Disclosure: Zee Drive is a tool that my organisation develops

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.