Blu*_*ppy 7 powershell-2.0 drive-mapping
我试图在PowerShell 2.0中映射驱动器并收到此错误?
New-PSDrive –Name ftp –PSProvider FileSystem –Root “\\server\folder” -Credential $credential
The provider does not support the use of credentials. Perform the operation again without specifying credentials.
Run Code Online (Sandbox Code Playgroud)
但是,Get-Help New-PSDrive显示-Credential为有效选项?
这是PS中的版本问题吗?有没有另一种方法来做同样的...我宁愿把它保持在PS内(因为驱动器只是那时的PS)而不是辍学NET USE - NET USE /d但需要必须!
这是PowerShell 2.0中的一个错误
从以上链接解决方法:
$net = new-object -ComObject WScript.Network
$net.MapNetworkDrive("u:", "\\server\share", $false, "domain\user", "password")
Run Code Online (Sandbox Code Playgroud)
据说固定在3.0(我自己没有测试过).
| 归档时间: |
|
| 查看次数: |
13408 次 |
| 最近记录: |