【发布时间】:2020-12-03 18:26:48
【问题描述】:
能够针对Microsoft.PowerShell (5.1) 执行此操作,但今天我在远程Copy-Item 上遇到了一个已知问题,因此我在远程服务器上安装了 PowerShell 7(在安装程序中选中“启用远程处理”)和我正在努力让它工作。
$securePassword = ConvertTo-SecureString -AsPlainText -Force -String $Password
$credential = New-Object -TypeName system.management.automation.pscredential -ArgumentList $Username, $securePassword
$session = New-PSSession $targetMachineHostName -Credential $credential -ConfigurationName "Microsoft.PowerShell"
Enter-PSSession $session
上面的作品。但是,如果我将 ConfigurationName 更改为“PowerShell.7.1.0" 我得到:
[myserver.com.au] Connecting to remote server myserver.com.au failed with
| the following error message : <f:WSManFault
| xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="2689860592"
| Machine="myserver.com.au"><f:Message><f:ProviderFault provider="PowerShell.7.1.0"
| path="C:\Windows\system32\PowerShell\7.1.0\pwrshplugin.dll"></f:ProviderFault></f:Message></f:WSManFault> For more information, see the about_Remote_Troubleshooting Help topic.
在远程服务器上,我在 7.1 powershell 中运行了 enable ps remoting,所以如果我运行 Get-PSSessionConfiguration 它会返回一堆配置,包括以下内容:
Name : PowerShell.7.1.0
PSVersion : 7.1
StartupScript :
RunAsUser :
Permission : NT AUTHORITY\INTERACTIVE AccessAllowed, BUILTIN\Administrators AccessAllowed, BUILTIN\Remote
Management Users AccessAllowed
错误所指的dll存在于机器上。
我使用的用户凭据用于远程计算机上的本地用户,该用户不是管理员,但属于 Remote Management Users 组。
另外值得注意的是远程机器本身(作为不同的管理员本地帐户,我可以启动与localhost 的会话)。
【问题讨论】:
-
似乎通过使用户成为管理员它可以工作......
-
最重要的是,仍然无法成功运行
Copy-Item...叹息
标签: powershell powershell-remoting winrm powershell-7.0