Skip to content

Commit

Permalink
Add install and savelocal scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
mxk committed Nov 4, 2023
1 parent 7e6ad68 commit 84f9e35
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,4 @@ To extract `PolicyDefinitions` from a Windows ISO:

## Local policy

The current local policy can be obtained with the following command in a Command Prompt running as an Administrator:

```
rmdir /s /q LGPO & mkdir LGPO & LGPO.exe /b %cd%\LGPO & GPO2PolicyRules.exe .\LGPO LGPO.PolicyRules
```
Run `.\savelocal.cmd <out-file> <policy-name>` as an Administrator to save the local group policy as a `PolicyRules` file. This will overwrite the contents of `C:\GPO`.
17 changes: 17 additions & 0 deletions install.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@echo off
setlocal

if /i "%1" == "/y" goto :install
set /p "confirm=Install GPO as Local Computer Policy (y/[n])? "
if /i "%confirm%" neq "y" goto :eof

:install
pushd %~dp0
.\LGPO\LGPO.exe /p .\PolicyRules\Win11.PolicyRules /v
popd

echo.
echo Restart computer to apply changes!
echo.

if /i "%1" neq "/y" pause
20 changes: 20 additions & 0 deletions savelocal.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@echo off
setlocal

if "%~1" == "" goto :usage
if "%~2" == "" goto :usage
goto :main

:usage
echo usage: %0 out-file policy-name
echo.
goto :eof

:main
pushd %~dp0
rmdir /s /q C:\GPO
mkdir C:\GPO
.\LGPO\LGPO.exe /b C:\GPO /n "%~2"
move C:\GPO\{*} C:\GPO\{00000000-0000-0000-0000-000000000000}
.\PolicyAnalyzer\GPO2PolicyRules.exe C:\GPO "%~1"
popd

0 comments on commit 84f9e35

Please sign in to comment.