New-PSSession localhost失败:WinRM无法处理请求

时间:2018-02-08 14:40:43

标签: powershell authentication localhost winrm

我遇到了我想在服务器上启动New-PSSession的问题。如果我在powershell中输入命令,我将收到以下错误:

New-PSSession : [localhost] Connecting to remote server localhost failed with
the following error message : WinRM cannot process the request. The following
error with errorcode 0x80090322 occurred while using Negotiate authentication:
An unknown security error occurred.
 Possible causes are:
  -The user name or password specified are invalid.
  -Kerberos is used when no authentication method and no user name are
specified.
  -Kerberos accepts domain user names, but not local user names.
  -The Service Principal Name (SPN) for the remote computer name and port does
not exist.
  -The client and remote computers are in different domains and there is no
trust between the two domains.
 After checking for the above issues, try the following:
  -Check the Event Viewer for events related to authentication.
  -Change the authentication method; add the destination computer to the WinRM
TrustedHosts configuration setting or use HTTPS transport.
 Note that computers in the TrustedHosts list might not be authenticated.
   -For more information about WinRM configuration, run the following command:
winrm help config. For more information, see the about_Remote_Troubleshooting
Help topic.
At line:1 char:1
+ New-PSSession
+ ~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:Re
   moteRunspace) [New-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : -2144108387,PSSessionOpenFailed

为什么没有可能启动本地 PSSession?我已经检查了winrm配置但是没有帮助我。你能帮帮我吗?

由于

编辑1 我尝试与主机建立远程会话时得到的错误:

PS C:\Windows\system32> Invoke-Command -ComputerName xxxxxx.xxxxxxx.net {Hostname}
[xxxxxx.xxxxxxx.net] Connecting to remote server xxxxxx.xxxxxxx.net failed with the following error message : WinRM cannot process the request. The following error with errorcode 0x80090322 
occurred while using Kerberos authentication: An unknown security error occurred.  
 Possible causes are:
  -The user name or password specified are invalid.
  -Kerberos is used when no authentication method and no user name are specified.
  -Kerberos accepts domain user names, but not local user names.
  -The Service Principal Name (SPN) for the remote computer name and port does not exist.
  -The client and remote computers are in different domains and there is no trust between the two domains.
 After checking for the above issues, try the following:
  -Check the Event Viewer for events related to authentication.
  -Change the authentication method; add the destination computer to the WinRM TrustedHosts configuration setting or use HTTPS transport.
 Note that computers in the TrustedHosts list might not be authenticated.
   -For more information about WinRM configuration, run the following command: winrm help config. For more information, see the about_Remote_Troubleshooting Help topic.
    + CategoryInfo          : OpenError: (xxxxxx.xxxxxxx.net:String) [], PSRemotingTransportException
    + FullyQualifiedErrorId : -2144108387,PSSessionStateBroken

1 个答案:

答案 0 :(得分:0)

这可能是下面的重复或非常接近的相似性。

  

New-PSSession无法在本地工作我正在尝试连接到   localhost使用New-PSSession。

     

New-PSSession does not work locally

至于......

  

为什么没有可能启动本地PSSession?

如上所述,您可以正确设置所有内容。问题是你为什么这么做?

远程会话(隐式/显式)专门用于为您提供对远程主机的交互式和自动化访问。

您已在本地主机上拥有该功能。那么,为什么要远离自己呢?这就像给自己写一封信,然后邮寄给自己。

我明白了,如果这是你唯一的设备而且你想练习玩远程会话,但除此之外,它不会给你买任何东西。

最后,对于域加入服务器,这只适用于WS2K8及更高版本,当我测试它时,它确实有效。对于非域计算机/工作站,您将不得不跳过几个环节。