psremoting和credsspauthentication到本地主机

我有两台机器AB.

两者都有:psremoting启用,credssp启用作为客户端和服务器。

从机器A我可以用-Authentication credssp创build一个新的pssession

从机器B我可以创build一个新的pssession与-Authentication credssp

在这一点上一切正常。 我的问题是,我有一个脚本,将在计算机A上运行,并启动AB两个新的pssession并移动一些文件(共享点的东西是完全不同的事情)。 我编写的脚本最初是从外部计算机运行的,因此它具有可以远程进入两个系统的代码。 但是现在脚本正在从计算机A运行,而且对于我来说,我不能在本地主机上运行。

我试过设置-delegatecomputer (对于enable-wsmancredssp -role客户端)和-computername (对于新的-seseauthenticationcredssp)任何一个.localhost127.0.0.1 。 这些都不允许我从计算机A回到电脑A开始一个新的娱乐。

所以我的问题的核心是:

  1. 你可以委托credssp凭据本地主机?
  2. 如果没有,是否有创build一个pssession的方法,让我仍然login到该会话内的共享点(即进一步传递凭据)?
  3. 最坏的情况:我将不得不重写我的脚本。

连接到本地计算机应该工作得很好。 不过,只是自己做一个快速的尝试,我不得不使用本地计算机的计算机名称来连接,而不是本地主机(猜测这与NTLM vs Kerberos有关)。 所以运行下面的命令(在PowerShell 2的Windows Server 2008 R2计算机上)为我分配的罚款:

 启用-WSManCredSSP  - 服务器
启用-WSManCredSSP -Role客户端-DelegateComputer MyComputerNameHere
 $ session = New-PSSession -ComputerName MyComputerNameHere -Authentication Credssp -Credential(Get-Credential) 

为了使它在一个非域join的计算机(在使用PowerShell 4的Windows 8.1计算机上)工作,但是,我还必须对组策略进行更改(在提供的错误消息中提到了这一点)。 我需要做的configuration是启用Computer Configuration -> Administrative Templates -> System -> Credentials Delegation -> Allow Delegating Fresh Credentials with NTLM-only Server AuthenticationconfigurationComputer Configuration -> Administrative Templates -> System -> Credentials Delegation -> Allow Delegating Fresh Credentials with NTLM-only Server Authentication并将计算机名称添加到该策略中的计算机名称列表。 在更改之后,即使在未join域的计算机上,上述代码也可以正常工作。