【问题标题】:PowerShell New-PSDrive not working with authenticationPowerShell New-PSDrive 无法使用身份验证
【发布时间】:2015-04-16 09:41:56
【问题描述】:

我正在尝试将 SharePoint 文档库映射为字母 Z。将 Windows 资源管理器中的驱动器映射为“映射网络驱动器”并提供凭据工作正常。

但是如何在 PowerShell 中映射此驱动器,而不使用 Windows 资源管理器 GUI 步骤进行身份验证?

我尝试使用New-PSDrive-Credential 开关,但随后 PowerShell 抱怨找不到驱动器...

代码:

$Sharepoint = 'http://My site/Documents/Folders - Permission matrix'
New-PSDrive -Name Z -PSProvider FileSystem -Root $Sharepoint -Credential $Credential

错误:

New-PSDrive : The specified drive root "http://My site/Documents/Folders - Permission matrix" either does not exist, or it is not a folder.

感谢您的帮助。

【问题讨论】:

    标签: powershell


    【解决方案1】:

    我认为您的语法对New-PSDrive 无效。 FileSystem Provider 不包含以http 前缀指定的元素。

    您应该使用 \\My site\Documents\Folders - Permission matrix 作为 New-PSDrive 的输入,因为 FileSystem 提供程序接受 UNC 路径。

    【讨论】:

    • 谢谢majkinetor,确实是这个问题。
    猜你喜欢
    • 2022-12-23
    • 2019-03-25
    • 1970-01-01
    • 2013-05-30
    • 2015-03-14
    • 1970-01-01
    • 2019-04-01
    • 2012-03-31
    • 2018-02-19
    相关资源
    最近更新 更多