Blog Post

Microsoft Security Baselines Blog
2 MIN READ

LGPO.exe - Local Group Policy Object Utility, v1.0

Aaron Margosis's avatar
Aaron Margosis
Iron Contributor
Jun 18, 2019
First published on TechNet on Jan 21, 2016
LGPO.exe is a new command-line utility to automate the management of local group policy. It replaces the no-longer-maintained LocalGPO tool that shipped with the Security Compliance Manager (SCM), and the Apply_LGPO_Delta and ImportRegPol tools.

Features:

  • Import settings into local group policy from GPO backups or from individual policy component files, including Registry Policy (registry.pol), security templates, and advanced auditing CSV files.

  • Export local policy to a GPO backup.

  • Parse a Registry Policy (registry.pol) file to readable "LGPO text" directly to the console or redirected to a file which can edited and imported into local policy.

  • Build a new Registry Policy (registry.pol) file from "LGPO text".

  • Enable group policy client side extensions for local policy processing.


The zip file attached to this post includes LGPO.exe and full documentation. This is the command line syntax:

LGPO.exe v1.00 - Local Group Policy Object utility

LGPO.exe has four modes:
* Import and apply policy settings;
* Export local policy to a GPO backup;
* Parse a registry.pol file to "LGPO text" format;
* Build a registry.pol file from "LGPO text".

To apply policy settings:

LGPO.exe command [...]

where "command" is one or more of the following (each of which can be repeated):

/g path               import settings from one or more GPO backups under "path"
/m path\registry.pol  import settings from registry.pol into machine config
/u path\registry.pol  import settings from registry.pol into user config
/s path\GptTmpl.inf   apply security template
/a[c] path\Audit.csv  apply advanced auditing settings; /ac to clear policy first
/t path\lgpo.txt      apply registry commands from LGPO text
/e <name>|<guid>      enable GP extension for local policy processing; specify a
GUID, or one of these names:
* "zone" for IE zone mapping extension
* "mitigation" for mitigation options, including font blocking
* "audit" for advanced audit policy configuration
/boot                 reboot after applying policies
/v                    verbose output
/q                    quiet output (no headers)

To create a GPO backup from local policy:

LGPO.exe /b path [/n GPO-name]

/b path               Create GPO backup in "path"
/n GPO-name           Optional GPO display name (use quotes if it contains spaces)

To parse a Registry.pol file to LGPO text (stdout):

LGPO.exe /parse [/q] {/m|/u} path\registry.pol

/m path\registry.pol  parse registry.pol as machine config commands
/u path\registry.pol  parse registry.pol as user config commands
/q                    quiet output (no headers)

To build a Registry.pol file from LGPO text:

LGPO.exe /r path\lgpo.txt /w path\registry.pol [/v]

/r path\lgpo.txt      Read input from LGPO text file
/w path\registry.pol  Write new registry.pol file

(See the documentation for more information and examples.)

[Update: the latest version of LGPO.exe is here .]
Updated Nov 09, 2023
Version 2.0

9 Comments

  • blueskyahead's avatar
    blueskyahead
    Copper Contributor

    AaronMargosis_Tanium That is my bad. I forgot a step in the path. It should be Windows Settings =>Security Settings => Software Restriction Policies => Additional Rules 

  • I don't see an "Additional Rules" subfolder in my GP editor. Are you referring to path rules in AppLocker ("Application Control Policies")? If so, LGPO.exe is not the tool I'd use.

  • LGPO.exe merges in the settings that you specify in the input files. You can selectively revert settings to "not configured" as a one-time operation using the CLEAR action in an LGPO-text file, or in an ongoing manner using the DELETE, DELETEALLVALUES, or DELETEKEYS actions. You can revert all registry.pol-related settings to "not configured" by manually deleting the registry.pol files and then running gpupdate. That won't revert advanced auditing settings nor any that are specified in security template files.

  • Aaron Margosis: does it apply the local GPO in replace mode or merge mode? I couldn't see a switch to use it in replace mode so that only the settings mentioned in the Local GPO export are applied and any settings which are pre-existing can be wiped off (changed to Not Configured).

  • I created a DSC profile that generates registry.pol file and gpupdate /force is able to implement this registry.pol file into Machine CONFIG in Registry. I wanted to understand if the same set of registry settings are being applied from AD GPO through GP Preferences, will that override/amend this regsitry.pol file under Group Policy directory in Windows?

  • doctordns's avatar
    doctordns
    Brass Contributor

    Anychance of PowerShell cmdlets instead of a Win32 Console app?

  • ThaoNT33's avatar
    ThaoNT33
    Copper Contributor

    Hi!

     

    If we use LGPO to make our product, do we need to pay any attention to the copyright ?