Powershell CREDSSP问题

时间:2018-05-18 21:57:00

标签: powershell credssp

我正在尝试在新服务器(服务器C)上使用CREDSSP

我已在两台其他服务器上成功设置了credssp。 (服务器A到服务器B)

我现在正尝试使用CREDSSP从服务器A连接到服务器C,但无论我做什么,我都会收到以下错误:

[SERVER_C.domain.edu]连接到远程服务器SERVER_C.domain.edu失败,并显示以下错误消息:拒绝访问。有关详细信息,请参阅about_Remote_Troubleshooting帮助主题。     + CategoryInfo:OpenError:(SERVER_C.domain.edu:String)[],PSRemotingTransportException     + FullyQualifiedErrorId:AccessDenied,PSSessionStateBroken

这是我的查询,从服务器A到服务器B完美运行:

# Setting the Credentials to be used to sign into the Server B. 
    $pass = ConvertTo-SecureString "Password" -asplaintext -force
    $mycred = new-object -typename System.Management.Automation.PSCredential -argumentlist "domain\user.service",$pass
#
#
# The Remote Execution Command. Fully Qualified Domain name is critical since we are using Credssp.
# Credssp is being used to resolve an issue with a double hop authentication issue. Other steps setup on each computer had to be completed before Credssp would work
   Invoke-Command -ComputerName SERVER_B.domain.edu -command { C:\helloWorld.ps1 } -Authentication Credssp  -Credential $mycred

我已经仔细检查了服务器C(新服务器)和服务器B(旧服务器)之间我能想到的一切,但我找不到任何可能导致错误的原因。

我知道如果我取出CREDSSP部分,该脚本可以工作,除非涉及双跳。所以服务器绝对是连接。

我确保运行以下命令:

Enable-psremoting

Set-ExecutionPolicy -Scope localMachine -ExecutionPolicy RemoteSigned

Enable-WSManCredSSP -Role Client -DelegateComputer '*.reskit.org' –Force 
Enable-WSManCredSSP -Role Server –Force

wsman

同样遵循以下步骤:使用gpedit.msc并查看以下策略:计算机配置 - >管理模板 - >系统 - >凭证授权 - >允许委派新证书。验证是否已启用并配置了适用于目标计算机的SPN。例如, 对于目标计算机名称" myserver.domain.com",SPN可以是以下之一:WSMAN / myserver.domain.com或WSMAN / * .domain.com。有关更多信息,请参阅 about_Remote_Troubleshooting帮助主题。

正如我所提到的,我知道服务器A设置正确,因为我将上面的脚本运行到服务器B没有问题。

任何建议都会受到赞赏。

我唯一的想法是服务器A和B正在运行Powershell 3而服务器C正在运行Powershell 5

1 个答案:

答案 0 :(得分:0)

我注意到Enable-WSManCredSSP -Role Client命令使用* .reskit.org而不是* .domain.eu。(?)

对我来说,并不完全清楚哪些命令在服务器或客户端运行,但一见即可。我最近配置了credssp来解决双跳问题,如下所示:

在服务器上:

Enable-WSManCredSSP -Role Server -Force

Get-WSManCredSSP显示:计算机未配置为允许委派新凭据。此计算机配置为从远程客户端计算机接收凭据。

在客户端:

winrm quickconfig
Enable-WSManCredSSP -role client *.mydomain.com

Get-WSMancredSSP显示: 该计算机配置为允许将新凭据委派给以下目标:wsman / * .mydomain.com。此计算机未配置为从远程客户端计算机接收凭据。

我的客户端脚本通过以下方式启动显式远程会话:

$session = New-PSSession -Computer $computerName -Credential $credential -Authentication Credssp
相关问题