gpt4 book ai didi

powershell - 通过 AWS 用户数据字段在 Windows Server 2012 上启用远程连接

转载 作者:行者123 更新时间:2023-12-02 23:46:55 26 4
gpt4 key购买 nike

当我不小心禁用了“高级系统设置”下的“远程连接”时,我正在通过 RDP 处理运行 Windows Server 2012 的 AWS EC2 实例,这立即关闭了我的 RDP session 。

是否有任何脚本可以放入 EC2“用户数据”字段中,以便在我重新启动实例时重新启用远程连接?

如果没有,有没有办法通过在另一个实例下安装驱动器来重新启用它?

谢谢

最佳答案

我最终做了以下事情:

Stop the instance, detach the root volume and attach it as another partition on another Windows instance. Once attached, go to disk management and set it online, mount the registry hive and make the proper changes.

Navigate to the following location in the registry

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server


在右 Pane 中,找到名为 fDenyTSConnection 的 REG_DWORD 值。双击 fDenyTSConnection 并将值数据从 1(禁用远程桌面)更改为 0(启用远程桌面)。
如果服务器处于排空模式,则找到名为 TSServerDrainMode 的 REG_DWORD 值并将值数据从 1(禁用远程桌面)更改为 0(启用远程桌面)。
卸载注册表,将磁盘设置为脱机,分离 EBS 卷,并将其作为原始 Windows 实例的根卷附加回来,并验证您现在是否可以访问它。
来源: https://forums.aws.amazon.com/thread.jspa?threadID=128525

也可以看看:

How to mount a registry hive in Regedithttp://www.youtube.com/watch?v=UuSxbDIlFW0

关于powershell - 通过 AWS 用户数据字段在 Windows Server 2012 上启用远程连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18522904/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com