I am trying to map a SharePoint 2016 on-prem document library as a shared drive.

I can map it manually but I am trying to do it with PowerShell

my document library url is http://mysharepointinstance/sitename/documentlibrary

Note: site is not SSL configured and code will execute on a Windows 10 box

$LibraryPath = "\\mysharepointinstance@SSL\DavwwwRoot\sitename\documentlibrary"
New-PSDrive -name "R" -Root $LibraryPath -PSProvider filesystem

but I am getting error

The specified drive root "\\mysharepointinstance@SSL\DavwwwRoot\sitename\documentlibrary" either does not exist, or it is not a folder.

I tested your script in my environment which was configured SSL, it worked fine.

Also, I tested your script in my environment which was not configured SSL, I got the same error message as yours.

So, your issue is caused by you didn’t configure SSL in your environment. Please refer to the following article to configure SSL: Configure SSL for SharePoint 2013/2016

If you don’t want to configure SSL, you can try the following script :

$LibraryPath = "http:// mysharepointinstance/sitename/documentlibrary"

#Map Path as Network Drive
$Network = new-object -ComObject WScript.Network
$Network.MapNetworkDrive('R:', $LibraryPath)
  • worked, thank you. – Ali Oct 18 '20 at 23:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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