如何使用PowerShell或CMD启用组策略切换按钮

发布于 2025-01-26 20:37:29 字数 370 浏览 5 评论 0 原文

我正在尝试使用UserData自动化Windows 2019服务器的切割设置。我需要更新本地组策略设置。

我要启用的特定组策略是“设置断开连接会话的时间限制”

“在此处输入图像说明”

如何使用PowerShell或Bash甚至重新启动VM启用此'本地'组策略。

我已经尝试过,但我似乎无法将其处于“启用”状态。

I am trying to automate sever setup of a windows 2019 server using userdata. I need to update the local group policy settings.

The specific group policy i want to enable is "Set time limit for disconnected sessions"

enter image description here

How can i enable this 'local' group policy for a vm using powershell or bash or even Regedit.

I have tried but i cant seem to get it be in an "enabled" state.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

泅人 2025-02-02 20:37:30

查看此注册表编辑。

您可以访问此

更多信息此处。

reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v MaxDisconnectionTime /t REG_DWORD /d 5000 /f

Look at this Registry Edit.

You can access this registry key in Powershell or Bash.

More information here.

reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v MaxDisconnectionTime /t REG_DWORD /d 5000 /f
恰似旧人归 2025-02-02 20:37:30

尝试一下,它是相同的注册表密钥,但使用PowerShell设置。

Set-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" -Name MaxDisconnectionTime -Type REG_DWORD -Value 900000

该值在MS中,将其设置为15分钟。

运行该设备后,重新启动设备和设置应更新。

Try this, its the same registry key but using Powershell to set.

Set-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" -Name MaxDisconnectionTime -Type REG_DWORD -Value 900000

The value is in ms, this would set it to 15 minutes.

https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.TerminalServer::TS_SESSIONS_Disconnected_Timeout_2

After you run that, restart the device and the settings should be updated.

请帮我爱他 2025-02-02 20:37:30

无法使用PowerShell直接配置本地组策略。

配置后,GPO设置注册表密钥和值。
您可以在其中设置注册表密钥,然后配置GPO是双向的。

您可以使用Microsoft的工具 lgpo.exe 从要配置的计算机中导出策略设置,然后使用PowerShell将这些设置导入到新计算机。

There is no way to directly configure the local group policy using PowerShell.

When configured, the GPO sets a registry key and value.
It's not bi-directional where you can set the registry key and then the GPO is configured.

You can use Microsoft's tool LGPO.exe to export the policy settings from a computer you've configured, and then use PowerShell to import those settings to your new computer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文