Command to change Local Group Policy Setting.

asked 2021-11-25T14:13:01.377+00:00
VM 21 Reputation points

Hello,

Looking for a command to change the local group policy setting.

Ideally, when we change any setting from the local group policy, the related registry key gets created.

I tried to create a registry directly by command, but changes were not applied.

I am trying to enable the below local group policy.

Computer Configuration\Administrative Templates\Windows Components\Windows update**Remove access to use all Windows update features**

After enabling the above policy, the registry key SetDisableUXWUAccess (value 1) gets created under HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate

And then Check for updates gets grayed out.

But, when I directly create the registry key SetDisableUXWUAccess (value 1) under HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate

Then Check for updates won't get gets grayed out.

Hence, looking for a command to enable the below local group policy setting.

Computer Configuration\Administrative Templates\Windows Components\Windows update**Remove access to use all Windows update features**

any help for the command?

Windows Group Policy
Windows Group Policy
A feature of Windows that enables policy-based administration using Active Directory.
1,869 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
4,618 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. answered 2021-11-25T16:10:38.46+00:00
    Leon Laude 84,996 Reputation points

    Hi @VM ,

    You need to run the GPUpdate /Force command after creating the registry key from the command-line, after that it should be active, sometimes even a reboot is required.

    The command would be:

    New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "SetDisableUXWUAccess" -Value ”1”  -PropertyType "DWORD"  
    

    ----------

    If the reply was helpful please don't forget to upvote and/or accept as answer, thank you!

    Best regards,
    Leon