Scenario: I have a newly created Office365 realm for an arbitrary domain. I need to mount the Sharepoint/OneDrive piece of it as a drive via powershell. This seems to be possible as can be seen here: Technet

My problem is, how do I determine exactly what the unc is that I need to pass into New-PSDrive?

My tests have been failing miserably:

New-PSDrive -Name T -PSProvider FileSystem -Root '\\test.onmicrosoft.com@SSL\Documents' -Credential $Creds
New-PSDrive : The network path was not found

Edit: Just to make things more clear: Given an office365 account with a particular username, what is the path to the root directory of sharepoint and/or onedrive for that account? I'll try and figure the powershell out


After some serious trial and error, I discovered the correct URL. Leaving it here for others:

Given a company named 'test' and a user defined as "user", your unc and creds would be:

Credentials would need to be:

username: user@test.onmicrosoft.com

New-PSDrive -Name J -PSProvider FileSystem -Root \\test-my.sharepoint.com@SSL\DavWWWRoot\personal\user_test_onmicrosoft_com\Documents

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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