无法自动登录 RDP 会话:服务器的身份验证策略不允许使用已保存的凭据发出连接请求

无法自动登录 RDP 会话:服务器的身份验证策略不允许使用已保存的凭据发出连接请求

我尝试进入组策略并启用/禁用一些相关策略,但仍然看到以下内容:

在此处输入图片描述

Remember me我检查并输入正确的密码没关系。

凭证存储在本地但未被使用:

在此处输入图片描述

我正在从 Windows 10 连接到 Windows 7。

gupdate输出:

Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

PS C:\> gpupdate.exe
Updating Policy...

User Policy update has completed successfully.
Computer policy could not be updated successfully. The following errors were encountered:

The processing of Group Policy failed because of an internal system error. Please see the Group Policy operational log for the specific error message. An attempt will be made to process Group Policy again at the next refresh cycle.
The processing of Group Policy failed because of an internal system error. Please see the Group Policy operational log for the specific error message. An attempt will be made to process Group Policy again at the next refresh cycle.
The processing of Group Policy failed because of an internal system error. Please see the Group Policy operational log for the specific error message. An attempt will be made to process Group Policy again at the next refresh cycle.
The processing of Group Policy failed because of an internal system error. Please see the Group Policy operational log for the specific error message. An attempt will be made to process Group Policy again at the next refresh cycle.
The processing of Group Policy failed because of an internal system error. Please see the Group Policy operational log for the specific error message. An attempt will be made to process Group Policy again at the next refresh cycle.

To diagnose the failure, review the event log or run GPRESULT /H GPReport.html from the command line to access information about Group Policy results.

抓住GPRESULT /H GPReport.html


Registry    Failed  12/12/2017 4:06:01 PM
Registry failed due to the error listed below.

Unspecified error

Additional information may have been logged. Review the Policy Events tab in the console or the application event log for events between 12/12/2017 4:06:01 PM and 12/12/2017 4:06:01 PM.

GPReport.html包含:

Windows Components/Remote Desktop Services/Remote Desktop Session Host/Security
Policy  Setting Winning GPO
Always prompt for password upon connection  Enabled {ID}, domain.com

但是,在组策略编辑器中:

在此处输入图片描述

我如何强制禁用该策略?

答案1

发生这种情况是因为机器您尝试启动远程桌面连接的计算机不允许保存仅 NTLM 样式的凭据。当启动远程桌面连接的计算机与所连接的计算机位于不同的域或工作组中时,通常会发生这种情况。

您可以通过修改Allow Delegating Saved Credentials with NTLM-only Server Authentication组策略设置来覆盖此行为并启用保存 RDP 凭据。它位于:

Computer Configuration/Administrative Templates/System/Credentials Delegation

必须修改此政策在启动 RDP 连接的计算机上(或者如果通过域组策略传递则必须影响所述机器)。

启用保存 RDP 凭据全部远程服务器,启用 GP 设置,并在将服务器添加到列表:在策略设置中,添加TERMSRV/*如下所示的值:

在此处输入图片描述

如果您只希望将凭据委派给特定的远程计算机,请以以下格式输入TERMSRV/COMPUTERNAME。您可以提供多个值来配置多台远程计算机。

答案2

我公司的 IT 团队已禁用已保存凭据的使用,我已尝试 TheKingOfScandinavia 和“我说恢复 Monica”的解决方案,但它们对我没有用。

相反,我采用了一种技术含量很低的解决方案,即一个 powershell 脚本,打开远程桌面窗口,等待,输入密码并按回车键。

我觉得这个解决方案很丑陋,但它确实能起到作用,它让我不用每天手动登录 5 台机器来确保我们的服务账户已登录

这是我的 powershell 脚本:automaticMachineLogin.ps1

您只需设置您的机器名称、用户名和密码

Set-PSDebug -Trace 0
$servers= @("SERVNAME1", "SERVNAME2", "SERVNAME3")
$username = "YOURUSERNAME";
# read the password from a file, or have it hardcoded
#$pw = Get-Content C:\pw.txt
$pw = "YOURPASSWORD";

echo "password read from file: " $pw

# login with remote desktop
foreach ($server in $servers)
{     
  mstsc /v:$server
  # wait X seconds for the window to appear
  Sleep 5
  # creates a com object to send key strokes
  $wshell = New-Object -ComObject wscript.shell;
  # send the password
  $wshell.SendKeys($pw)
  # wait 1 second
  Sleep 1
  # send enter, this is a special chararecters for enter
  $wshell.SendKeys('~')
  Sleep 1
} 

# optionally kill the remote connection at the end, since all I want to login the user, but this is probably not required for others
# kill all the remote desktop tasks, i.e. named mstsc.exe 
Sleep 1
taskkill /IM "mstsc.exe" /F

请注意,如果您需要发送除 Enter 之外的一些特殊字符,这里是完整列表,这里是完整列表,以防您需要 shift、alt 等特殊键...https://docs.microsoft.com/en-us/previous-versions/office/developer/office-xp/aa202943(v=office.10)?redirectedfrom=MSDN

答案3

我无法发表评论来澄清问题,所以我不得不写这个作为答案:

是否[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows NT\Terminal Services]存在一个名为 REG_DWORD 的fPromptForPassword条目,其值为 1?

在我的 Windows 7 客户端上,此设置设为 1,这样我就可以在连接到远程主机时保存密码。

据我所知如果不允许客户端存储凭证,则客户端上的该值应设置为 0。

另外,这里详细回答了一个类似的问题:https://superuser.com/a/140322/115387

答案4

我遵循了 Franck Mesirard 写的关于使用 powershell 的内容,但由于我的密码确实有特殊字符,所以我添加了以下内容。

#enclose any special characters in {} in the password
$pw = $pw -replace '([^\w\s])', '{$1}'

相关内容