Command to change Local Group Policy Setting.

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

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
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
4,531 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.
5,282 questions
{count} votes

1 answer

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

    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