Set/Edit 在 windows 10 中使用 powershell 的远程桌面连接限制

Set/Edit remote desktop connection limit using powershell in windows 10

我在 Azure 上创建了 windows VM,并使用 RDP 登录到 VM。登录后,我将 RDS“限制连接数”更改为 2。现在我重新启动 VM,我无法再登录了。它说 “与这台计算机的连接数量有限,所有连接现在都在使用中。请稍后尝试连接或联系您的系统管理员”

我可以访问 powershell/PS 并且我可以 运行 Azure 门户中的任何 PS 脚本。因此,如果有人能给我 PS 脚本,它将 RDS“限制连接数”设置为 x,那就太好了。

注意:RDS - 远程桌面服务。您可以通过输入 gpedit.msc 到 windows 运行 框来导航到那里。然后 Computer Configuration -> Administrative Templates -> Windows Components -> Remote Desktop Services -> Remote Desktop Session Host -> Connections -> "Limit number of connections"

参考linkhttps://www.top-password.com/blog/enable-multiple-remote-desktop-connections-in-windows-server/

没有更新组策略的 PowerShell 脚本。要限制连接数,您可以在您的 Azure VM 门户中临时编辑相关注册表MaxInstanceCount

例如,将注册表 MaxInstanceCount 添加到值 300,参考 here

New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" -Name MaxInstanceCount -Value 300 -PropertyType DWORD -Force

请注意,您可以在登录到 Azure VM 后更新组策略,因为组策略会定期刷新。一小时后,注册表值可能会更改为原始值 2