Skip to content

Instantly share code, notes, and snippets.

@nerflad
Created July 1, 2016 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nerflad/771b1c375d2218220bba281cc2f31341 to your computer and use it in GitHub Desktop.
Save nerflad/771b1c375d2218220bba281cc2f31341 to your computer and use it in GitHub Desktop.
Windows: backup Local Group Policy to directory
:: Requires Administrator
:: Copies entire GP object directory from system32 to current working directory
@echo off
setlocal EnableExtensions
setlocal
set "dirname=.\policyobjects - %DATE% %TIME%"
takeown /a /f %systemroot%\system32\grouppolicy /r /d y
xcopy %systemroot%\system32\grouppolicy "%dirname%" /s /h /i /y
attrib -h .\policyobjects /d /s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment