Skip to content

About

Parses PolicyDefinitions folder to JSON/YAML format

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

 

History

34 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Windows ADMX Parser

This tool scans a Windows PolicyDefinitions directory (ADMX/ADML) and exports every policy definition into a structured JSON or YAML file. This was made for being able to quickly search for any string in LGPE to see the data/value/key/description. I personally used it in the win-config project for several options. This small parser project was inspired by the WindowsAdmxParser powershell module. However, since it's not entirely correct (sometimes KeyName is displayed instead of ValueName), the class is not inserted directly into KeyPath and KeyNames is not inserted directly into KeyPath.

Features

  • Automatically detects language folders, or use --language to use specific ones
  • Supports ignoring specific ADMX files, filtering by policy class (Machine/User), category name, or free-text policy search
  • Generates pretty JSON (or YAML) by default, --compress only affects JSON exports
  • Moves the Class directly into the KeyPath (HKLM, HKCU, both)
  • Every value includes its ADMX type in ValueType (Decimal, LongDecimal, String, Delete)
  • Keeps the element attributes a write needs (list Additive, ExplicitValue, ValuePrefix, Expandable, decimal MinValue/MaxValue/StoreAsText, text MaxLength, ...)
  • Adds meaning for Supported keys (supported.txt)

Requirements

  • Python 3.8+
  • pip install pyyaml for YAML output

Usage

python admx-parser.py [FLAGS]

CLI Flags

Flag Description Default
-d, --definitions PATH PolicyDefinitions directory C:\Windows\PolicyDefinitions
-l, --language LANG Include a language folder (repeatable) Auto-detected + en-US
-i, --ignore NAME Ignore an ADMX base name (repeatable), its categories stay if other files have policies under them None
--class {Machine,User} Restrict to policy class (repeatable) All
--category TEXT Filter by category substring None
--policy TEXT Filter by policy/display name substring None
--include-obsolete Include obsolete/deprecated policies Off
--format {json,yaml} Output format json
--compress Minified JSON (ignored for YAML) Pretty
--output PATH Custom destination file policies.json/policies.yaml (in current dir)
--categories-output PATH Custom destination for category metadata JSON (I use it for my website/app, if not trying to create a GUI using policies.json then this has no actual use) policyCategories.json next to output
-h, --help Shows flags from above -

Examples

# Default (pretty JSON)
python admx-parser.py

# YAML output, ignore inetres and WindowsUpdate ADMX files
python admx-parser.py --format yaml --ignore inetres --ignore WindowsUpdate

# Machine only policies under the Edge category, compressed JSON
python admx-parser.py --class Machine --category Edge --compress

# All policies + category JSON
python admx-parser.py --include-obsolete --output assets/policies.json --categories-output assets/policyCategories.json

# W11 25H2 V3.0 templates example
python admx-parser.py -d W11-25H2-V3-PolicyDefinitions -l en-US --include-obsolete --ignore inetres --ignore GroupPolicyPreferencesLogging --output assets/policies.json --categories-output assets/policyCategories.json
python admx-parser.py -d W11-25H2-V3-PolicyDefinitions -l en-US --include-obsolete --ignore inetres --ignore GroupPolicyPreferencesLogging --format yaml --output assets/policies.yaml

Output Structure

{
  "File": "AppPrivacy.admx",
  "CategoryName": "AppPrivacy",
  "CategoryKey": "AppPrivacy:AppPrivacy",
  "PolicyName": "LetAppsAccessAccountInfo",
  "Class": "Machine",
  "NameSpace": "Microsoft.Policies.AppPrivacy",
  "Supported": "Windows_10_0 - At least Windows Server 2016, Windows 10",
  "DisplayName": "Let Windows apps access account information",
  "ExplainText": "This policy setting specifies whether Windows apps can access account information.\n\nIf you enable this policy setting, Windows apps can access account information.",
  "KeyPath": [
    "HKLM\\Software\\Policies\\Microsoft\\Windows\\AppPrivacy"
  ],
  "Elements": [
    { "Type": "Enum", "ValueName": "LetAppsAccessAccountInfo", "Items": [
        { "DisplayName": "User is in control", "ValueType": "Decimal", "Data": "0" },
        { "DisplayName": "Force Allow", "ValueType": "Decimal", "Data": "1" },
        { "DisplayName": "Force Deny", "ValueType": "Decimal", "Data": "2" }
      ]
    }
  ]
},
- File: AppPrivacy.admx
  CategoryName: AppPrivacy
  CategoryKey: AppPrivacy:AppPrivacy
  PolicyName: LetAppsAccessAccountInfo
  Class: Machine
  NameSpace: Microsoft.Policies.AppPrivacy
  Supported: Windows_10_0 - At least Windows Server 2016, Windows 10
  DisplayName: Let Windows apps access account information
  ExplainText: |-
    This policy setting specifies whether Windows apps can access account information.

    If you enable this policy setting, Windows apps can access account information.
  KeyPath:
  - HKLM\Software\Policies\Microsoft\Windows\AppPrivacy
  Elements:
  - Type: Enum
    ValueName: LetAppsAccessAccountInfo
    Items:
    - DisplayName: User is in control
      ValueType: Decimal
      Data: '0'
    - DisplayName: Force Allow
      ValueType: Decimal
      Data: '1'
    - DisplayName: Force Deny
      ValueType: Decimal
      Data: '2'

About

Parses PolicyDefinitions folder to JSON/YAML format

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Contributors

Languages