Skip to content

Instantly share code, notes, and snippets.

@gmassawe
Created March 14, 2019 16:18
Show Gist options
  • Save gmassawe/746da66b10e163c95b6660afcafbd7e3 to your computer and use it in GitHub Desktop.
Save gmassawe/746da66b10e163c95b6660afcafbd7e3 to your computer and use it in GitHub Desktop.
Script to clear cached GPOs
@echo off
::
:: This script clears cached GPOs
:: George Massawe 03/14/2019
::
DEL /S /F /Q “%ALLUSERSPROFILE%\Microsoft\Group Policy\History\*.*”
REG DELETE HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy /f
REG DELETE HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies /f
REG DELETE HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies /f
DEL /F /Q C:\WINDOWS\security\Database\secedit.sdb
Klist purge
gpupdate /force
exit
@Gobie8791
Copy link

Line 7 does not work unless you put "" in
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy" /f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment