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

标签 powershell amazon-web-services amazon-ec2 windows-server-2012

当我在通过 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 Regedit http://www.youtube.com/watch?v=UuSxbDIlFW0

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

相关文章:

powershell - 选择对象不返回对象?

amazon-web-services - 将S3文件下载到EBS中的docker镜像

ios - 如何使用 AWS Cognito 联合身份登录 Instagram

MySQL vs Cassandra 用于 AWS ec2 上的读取密集型 Web 服务

powershell - 如何设置 $env :PATH in powershell

powershell - 从 powershell 模块运行应用程序洞察查询

django - Elastic Beanstalk 未在所有实例上部署

amazon-ec2 - 为 Spot 实例分配私有(private) IP

Windows ISO 8601 时间戳

git - AWS Codebuild - 执行 buildspec.yml 时如何读取提交上的标签?