Search code examples
windowspowershellgroup-policy

Windows 10 Local group policy edit via PowerShell


I tried to edit local group policy on Windows 10.

Steps:

  1. I tried to change value for local group policy. Local Group Policy Editor Example: Computer Configuration/Administrative Templates/Windows Components/ Microsoft Defender Antivirus/Scan/ Name: "Scan archive files" Value "Enabled"

  2. Next, I go to Registry Editor and find path "HKLM/Software/Policies/Microsoft/WindowsDefender/Scan" and find Disable Archive scanning with value 0

  3. I tried to edit this value to 1 via GUI and PowerShell Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows Defender\Scan\" -Name DisableArchiveScanning -Value 1. It value is changing for Registry Editor.

  4. I run gpupdate

  5. My policies do not changes.

What did I do wrong?

Is it possible to change policies via PowerShell?

UPDATED:

My target is change Local Group Policy remotely (best way via PowerShell). I found suggestion trying to change Registry Editor. Is it way to change Local group Policy remotely?

Also, I tried to change file C:/Windows/system32/GroupPolicy/Machine/Registry.pol


Solution

  • I found answer. I can use PolicyFileEditor and related answer After run PolicyFileEditor command you should run gpupdate and new policy is applied. I checked it by trying edit setting established by policy and value did not changes if you try to correct it. Value can be changed if you change policy. But in Local Group Policy Editor you can not see parameters changes.