简体   繁体   English

如何使用 PowerShell 编辑本地组策略

[英]How to Edit Local Group Policy using PowerShell

In Local Group Policy Editor (GUI) there is a setting called Do not allow window animations located in Computer Configuration -> Administrative Templates -> Windows Components -> Desktop Window Manager that I would like to set as Enabled using the powershell, Since my windows version is professional I can added the RSAT GroupPolicy capability to my machine which I did and now I can use the Group Policy Cmdlets in Windows PowerShell在本地组策略编辑器 (GUI) 中,有一个名为Do not allow window animations的设置位于Computer Configuration -> Administrative Templates -> Windows Components -> Desktop Window Manager ,我想使用 powershell 将其设置为已启用,因为我的 windows版本是专业版 我可以将 RSAT GroupPolicy 功能添加到我的机器,现在我可以在 Windows PowerShell 中使用组策略 Cmdlet

but I am clue less on how to Enable that feature using the commands但我不太了解如何使用命令启用该功能

I tired to use我厌倦了使用

Get-GPO -Name "Do not allow window animations"

but this returns但这返回

Get-GPO : Current security context is not associated with an Active Directory domain or forest.

the grouppolicy module is wokring fine but I can't figure out how to query or change the value of any settings in the GPO grouppolicy 模块工作正常,但我不知道如何查询或更改 GPO 中任何设置的值

The Get-GPO function is meant exclusively for Domain Group Policies, and not Local Policies, which it seems you are referencing. Get-GPO function 专用于域组策略,而不是您正在引用的本地策略。 The description for the module also mentions this:该模块的描述还提到了这一点:

Gets one GPO or all the GPOs in a domain.获取域中的一个 GPO 或所有 GPO。

In order to modify local policies, you need to make a change to the respective setting in the registry为了修改本地策略,您需要更改注册表中的相应设置

For example to disable the Shutdown button, you would need to modify:例如要禁用关机按钮,您需要修改:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PolicyManager\default\Start\HideShutDown
Value = 1

If you want cmdlets in order to change values you can use the PolicyFileEditor module from the gallery https://www.powershellgallery.com/packages/PolicyFileEditor/3.0.1如果您想要 cmdlet 以更改值,您可以使用库中的 PolicyFileEditor 模块https://www.powershellgallery.com/packages/PolicyFileEditor/3.0.1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法使用 Powershell 将组策略(本地 gpo)状态更新为“未配置” - Unable to update group policy(local gpo) status to "Not Configured" using Powershell 如何通过 powershell ISE 脚本编辑安全选项(在本地安全策略中)? - How would I edit Security Options ( In Local Security Policy ) through a powershell ISE script? 使用VBScript查询本地组策略 - Querying Local Group Policy using VBScript 错误:使用组策略运行 Powershell 启动脚本时出现 CallDepthOverflow - Error: CallDepthOverflow when running Powershell startup scripts using Group Policy 使用Powershell向本地用户添加本地组时出错 - Error while adding a local group to local user using powershell 如何使用组策略添加入站规则 - how to add inbound rule using group policy 如何在本地组策略对象中为特定用户应用软件限制策略? - How to apply Software Restriction policy for specific user in local group policy object? 如何使用 c# 配置密码策略(组策略) - How can I configure Password Policy(Group Policy) using c# 从命令行(CMD)编辑Windows组策略 - Edit windows Group Policy from Command line (CMD) 使用Powershell启用\\禁用本地组策略 - Enable\Disable Local Group policies with powershell
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM