【发布时间】:2013-08-09 10:27:08
【问题描述】:
我是 powershell 新手,在使用凭据委派时遇到了麻烦。我有以下脚本:
$session = New-PSSession myserver -Authentication CredSSP -Credential DOMAIN\Administrator
Invoke-Command -Session $session -ScriptBlock { <Some PowerShell Command> }
在运行它之前,我做了以下事情:
- 在我的服务器上运行
Enable-PSRemoting。 - 在我的服务器上运行
Enable-WSManCredSSP Server。 - 在我的服务器上运行
Restart-Service WinRM。 - 在客户端上运行
Enable-WSManCredSSP Client –DelegateComputer myserver。 - 重新启动服务器和客户端。
但是一旦我运行脚本,我会收到以下错误消息:
[myserver] Connecting to remote server failed with the following error message : The WinRM client cannot process the request. A computer policy does not allow the delegation of
the user credentials to the target computer. Use gpedit.msc and look at the following policy: Computer Configuration -> Administrative Templates -> System -> Credentials Delega
tion -> Allow Delegating Fresh Credentials. Verify that it is enabled and configured with an SPN appropriate for the target computer. For example, for a target computer name "m
yserver.domain.com", the SPN can be one of the following: WSMAN/myserver.domain.com or WSMAN/*.domain.com. For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionOpenFailed
我检查了错误消息中提到的政策,但一切似乎都很好。还有什么可能阻止我?
【问题讨论】:
-
您在远程机器上被列为管理员吗?
-
@Blaine:我试图模拟的用户 DOMAIN\Administrator 是远程服务器的管理员。我还使用管理帐户连接到客户端计算机。
-
您是否在远程机器上启用了远程脚本:
Enable-PSRemoting -
我有。刚刚编辑了问题以提及这一点。感谢您指出。
标签: powershell powershell-remoting winrm