我正在尝试将SharePoint文档库映射为字母Z.将Windows资源管理器中的驱动器映射为“映射网络驱动器”并提供凭据可以正常工作。
但是如何在PowerShell中映射此驱动器并且不使用Windows资源管理器GUI步骤进行身份验证?
我尝试使用-Credential
的{{1}}开关,但PowerShell却抱怨找不到驱动器......
代码:
New-PSDrive
错误:
$Sharepoint = 'http://My site/Documents/Folders - Permission matrix'
New-PSDrive -Name Z -PSProvider FileSystem -Root $Sharepoint -Credential $Credential
感谢您的帮助。
答案 0 :(得分:1)
我认为您的语法对New-PSDrive
无效。 FileSystem Provider不包含使用http
前缀指定的元素。
您应该使用\\My site\Documents\Folders - Permission matrix
作为New-PSDrive
的输入,因为FileSystem提供程序接受UNC路径。