Local Group Policy Object Utility (Windows EXE)
What
LGPO.exe is Microsoft's Local Group Policy Object utility. It imports, exports, and applies local Windows Group Policy settings from the command line. It can help administrators configure local policies on devices that are not managed through Active Directory Group Policy.
There are two separate workflows in this article:
- Use Microsoft's LGPO commands to import an administrator-prepared policy file or backup. These commands do not provide an automatic per-setting uninstall.
- Use the Fileset template to manage one Computer registry-policy value with a saved original state and a separate removal operation. The template manages a narrower range of settings than LGPO itself; check its requirements below.
Before you begin
- Use an elevated administrator or LocalSystem context. Review the effect of the chosen policy before deployment and retain an independent recovery route.
- Back up local policy before making changes. A local-policy backup does not include every applied domain/MDM policy or all effects a setting may have caused.
- Test on a backed-up, non-production Windows device. Some policies require a sign-out/sign-in or restart before their effect can be assessed.
- Avoid overlapping policy ownership. Domain Group Policy, MDM, another Fileset, or a local administrator can change the effective result.
- Do not use
DisableMSI=2as a generic test. Microsoft documents that it disables Windows Installer for all applications, including repairs and reinstalls.
Get LGPO.exe
Download LGPO.zip from the Microsoft Security Compliance Toolkit, or use the existing LGPO utility attachment. The ZIP contains LGPO.exe, Microsoft's command reference, and the terms of use. Review the terms and verify the executable's Microsoft signature before use.
The Fileset includes Microsoft’s unchanged LGPO.exe together with apply and removal scripts.
Import a prepared policy with LGPO
- Create a Windows Fileset containing LGPO.exe and the required policy files. Choose explicit delivered paths; a FileWave script directory is not necessarily the directory containing the executable or policy file.
- Create the appropriate Windows script and use the command matching the input file. Run it with administrative privileges and wait for completion.
- Check the LGPO exit code before refreshing policy. A nonzero exit is an error, not a completed deployment.
- Deploy to a test device, inspect the stored and effective settings, and check the intended Windows/application behavior before expanding deployment.
For example, the following PowerShell fragment imports Computer registry policy from explicitly named files. Adjust both paths to the Fileset's actual destinations:
$ErrorActionPreference = 'Stop'
$lgpo = 'C:\ProgramData\FileWave\Installers\LGPO.exe'
$policy = 'C:\ProgramData\FileWave\Installers\registry.pol'
& $lgpo /m $policy /v
if ($LASTEXITCODE -ne 0) { throw "LGPO failed: $LASTEXITCODE" }
& "$env:WINDIR\System32\gpupdate.exe" /target:computer /force /wait:120
if ($LASTEXITCODE -ne 0) { throw "gpupdate failed: $LASTEXITCODE" }
This fragment is for import only. Deleting its Fileset payload does not restore the previous policy.
Common LGPO commands
Run these from the directory containing LGPO.exe, substituting your actual input/output paths. See the included LGPO.pdf for complete options and client-side extension requirements.
| Goal | Command |
|---|---|
| Apply LGPO text | LGPO.exe /t C:\Policy\lgpo.txt |
| Import a full GPO backup | LGPO.exe /g C:\Policy\Backup |
| Import Computer registry policy | LGPO.exe /m C:\Policy\registry.pol |
| Import system-wide User registry policy | LGPO.exe /u C:\Policy\registry.pol |
| Apply a security template | LGPO.exe /s C:\Policy\GptTmpl.inf |
| Apply advanced audit settings | LGPO.exe /a C:\Policy\Audit.csv |
| Export local policy to an existing writable folder | LGPO.exe /b C:\Policy\Backup /n "Before change" |
| Display a Computer Registry.pol file as LGPO text | LGPO.exe /parse /m C:\Policy\registry.pol |
| Build Registry.pol from LGPO text | LGPO.exe /r C:\Policy\lgpo.txt /w C:\Policy\registry.pol |
The /ac variation clears existing advanced audit policy
before applying its CSV. Use it only when that replacement is intended.
The /boot option restarts the device; do not add it to an
example deployment without planning the interruption.
LGPO also supports enabling Group Policy client-side extensions with
/e or importing extension references with /ef;
consult Microsoft's included reference for the extension required by
your policy. LGPO does not support Group Policy Preferences.
LGPO command options
/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)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)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)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 fileFileset template: apply and later restore one value
Download Example
LGPO Template.fileset.zip. The template contains
LGPO.exe, apply_policy.ps1, and
remove_policy.ps1. It saves the original local-policy and
live registry value before taking ownership. Removal reads that saved
identity and baseline rather than a separately maintained key/value in
the removal script.
For precise per-value changes, the scripts use Windows' Group Policy
API. LGPO supplies the backup. They do not use LGPO's
DELETE as a substitute for restoring prior state:
DELETE installs an instruction that keeps deleting a value
when policy refreshes. They also do not use CLEAR, which
removes an entire policy key and its subkeys from policy.
Fileset contents
The illustration shows the payload layout. Script sizes and IDs may
differ in the current download. LGPO.exe is delivered under
ProgramData\FileWave\Installers; the two scripts share the
Fileset’s script directory.
Scope and requirements
- One Computer policy value per configured owner, under a relative
Software\Policies\...key. - Elevated 64-bit Windows PowerShell 5.1 or later in STA mode. Run both scripts in an elevated 64-bit STA process and wait for their exit result. The scripts stop if the process is not STA or 64-bit.
- A non-domain-joined computer with exclusive local ownership of the target: no MDM policy, other Fileset, or concurrent policy editor managing that setting. The script rejects domain-joined computers, but it does not automatically discover every competing manager.
- An existing local-policy value must agree with the live registry value before enrollment. A mismatch stops the operation for investigation.
- Special registry-policy directives beginning
**anywhere in the machine policy cause the scripts to stop. User policies, MLGPO, security templates, audit-policy management, and Group Policy Preferences are outside the wrapper's scope; the general LGPO commands above have separate capabilities.
Previously deployed templates: downloading this revision does not update existing Filesets or recover their original settings. The old scripts did not save a baseline. Do not deploy this as an in-place replacement and assume removal can reconstruct it; first establish the intended policy state and a recovery plan for those devices.
Configuration
Set these process environment variables explicitly in both
script stages, including FW_POLICY_RECOVER=false.
The scripts do not query machine or user environment settings
separately, but a process can inherit variables from its parent. Do not
rely on inherited values or assume that omitting a variable clears
it.
| Variable | Required configuration |
|---|---|
FW_POLICY_ENABLED |
Exact true after reviewing your configuration; shipped
as false. |
FW_POLICY_EXCLUSIVE |
Exact true to acknowledge exclusive local ownership
with other writers excluded; shipped as false. This is an
administrator acknowledgement, not automatic conflict discovery. |
FW_POLICY_OWNER |
The same unique, stable owner in both stages: 3–64 lowercase letters, digits, dots, underscores, or hyphens, starting with a letter or digit. Replace the invalid placeholder. |
FW_LGPO_EXE |
Explicit absolute path in both stages; the template delivers
C:\ProgramData\FileWave\Installers\LGPO.exe. |
FW_POLICY_SCOPE |
Computer. |
FW_POLICY_RECOVER |
Keep false for ordinary operations. Enable only for an
inspected interrupted transaction as described below. |
Set these only in activation:
| Variable | Meaning |
|---|---|
FW_POLICY_KEY |
Relative literal subkey, such as
Software\Policies\FileWave\LGPOLab. Do not include
HKLM:. |
FW_POLICY_VALUE |
Explicit, nondefault value name, such as
ExampleValue. |
FW_POLICY_TYPE |
Exact DWORD, QWORD, SZ,
EXPAND_SZ, or MULTI_SZ. |
FW_POLICY_DATA |
Unsigned decimal for integers; literal text for strings; a JSON
string array for MULTI_SZ, such as
["first","second"]. Empty multi-string arrays/elements and
NUL-containing strings are rejected. |
The synthetic LGPOLab example tests storage and
restoration; it does not configure a Windows feature. The scripts do not
generate LGPO text, so pipe-separated multi-strings and LGPO escape
sequences from the older helper are not its input format.
Prepare the Fileset and device
- Import the template into an unassigned Fileset group. Review the script-stage settings and payload paths before assigning it. The shipped template is disabled; attempting to execute it unchanged returns an error, not a false success.
- Keep independent copies of the scripts for recovery in an administrator/SYSTEM-controlled location. Verify that ordinary users cannot modify or replace the scripts, LGPO.exe, or their containing paths; signature verification alone does not prevent replacement after checking. Do not run elevated copies from a user-writable Downloads or temporary directory. Configure your intended target and a unique owner in activation; use the harmless synthetic example for your initial test; configure the matching owner and common variables in pre-uninstallation. Keep removal in pre-uninstallation, while its sibling apply helper still exists.
- Use elevated, 64-bit Windows PowerShell in STA mode for both
scripts, with FileWave waiting for the exit result. For a manual run,
the equivalent launcher is
powershell.exe -NoProfile -NonInteractive -STA -File <script>. Do not bypass organizational execution policy. - Before first activation, provision the journal once on each intended
device. In an elevated 64-bit Windows PowerShell STA session, change to
the administrator-protected directory containing
apply_policy.ps1and run:
$env:FW_POLICY_ENABLED = 'true'
$env:FW_POLICY_EXCLUSIVE = 'true'
.\apply_policy.ps1 -Mode Initialize
Initialization creates an empty protected journal, not a policy setting. It refuses an existing directory, including a partially initialized one. It is a separate preparation step, not an activation hook.
The scripts retain the fixed recovery-directory name for
compatibility. The recovery directory is
%ProgramData%\FileWavePolicyJournal-review-v1, outside the
Fileset payload. Do not delete or reinitialize it to bypass an error.
Keep it and its backups protected and available after removal.
Apply and verify
Deploy to a prepared test device first, verify the result, and then
deploy to the intended prepared devices. A successful first run reports
Applied; repeating the exact same configuration reports
AlreadyApplied after checking the target. Neither repeat
captures a new original baseline.
Verify both the local policy and the effective registry value, then check the intended feature behavior if using a real policy. For the synthetic test value:
& 'C:\ProgramData\FileWave\Installers\LGPO.exe' /parse /m "$env:WINDIR\System32\GroupPolicy\Machine\Registry.pol"
Get-ItemProperty -LiteralPath 'HKLM:\Software\Policies\FileWave\LGPOLab' -Name 'ExampleValue'
A zero script exit is not proof of every later application, sign-in, or reboot effect. Retain the saved original state for any later removal. Normal deployment ends after the intended result is verified; removal is a separate lifecycle operation.
Remove later
When the configured Fileset is removed, its pre-uninstallation helper calls the shared engine in Remove mode. It uses the saved owner record, not activation inputs copied into removal.
- A previously configured value is restored to its saved type and bytes.
- If the local-policy value was originally absent, the managed entry is withdrawn without a persistent delete directive. The original live registry value is restored, or the live value is removed if it too was originally absent.
- Unrelated policy values are checked and preserved. Empty registry keys may remain; the operation restores the value, not the entire machine or original key layout.
- If the current target differs from the value this owner applied, removal stops rather than overwriting a later edit. Identical writes by another manager cannot be distinguished; exclusive ownership remains necessary.
Success reports Removed. Repeated removal reports
AlreadyRemoved without altering policy. Keep the completed
record: it prevents an old removal from undoing a newer owner's work. To
change the managed target/type/data, finish removal and use a new owner
ID; do not retarget an active owner or reuse a retired one.
Check the original local and live registry state again after policy refresh and any required restart. If pre-uninstallation fails, inspect FileWave’s script result and actual device state. Keep the independent recovery copies available; do not assume a failed script automatically prevents payload deletion.
Troubleshooting and recovery
- Disabled/unconfigured: inspect both lifecycle stages. Never enable the original disruptive example merely to test execution.
- LGPO unavailable or untrusted: correct the explicit path or investigate signature verification. There is no silent direct-registry fallback.
- Policy refresh failure: inspect the native error
and actual state. The script does not report success after a nonzero
gpupdateresult. A timed-out native process may still be running; inspect it before retrying. - Conflicting settings: investigate domain/MDM policy, other Filesets, or local edits. Do not delete another policy to force the scripts to proceed.
- Interrupted operation: preserve the complete
journal/backup directory and inspect current local/effective values and
any running native process. After review,
FW_POLICY_RECOVER=truemay resume the same pending operation; it does not bypass conflict checks or invent a baseline. Return it tofalseafterward. - Missing/corrupt state, pending
journal.next, or unrelated changes during an interrupted transaction: stop for manual reconciliation. Do not delete state, import a whole-machine backup as a single-value uninstall, or reinitialize an already managed device.
Restoring a local setting cannot undo every effect it caused, nor override the authoritative policy from another management system. Whole-GPO backup import is not an exact reset: LGPO imports settings without clearing unspecified existing settings.
Additional verification
Where available, use Local Group Policy Editor to inspect the setting
without editing it. For a Group Policy results report, create or choose
an existing output folder, then run
gpresult /h C:\Temp\gpresult.html /f (replace
C:\Temp if using another folder). The report supplements
the direct policy/registry and application-behavior checks; it is not a
substitute for them.
References
- Microsoft Security Compliance Toolkit
- Microsoft Security Compliance Toolkit documentation
- Microsoft's LGPO.pdf included in LGPO.zip
- Windows Group Policy object API: GetRegistryKey and Save

No comments to display
No comments to display