PowerShell Genie

Inventory GPOs

Script 2 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn

Get-GPO -All enumerates every policy object in the domain and the projection keeps the display name with its GUID and both timestamps.

The script

1PS> Get-GPO -All | Select-Object DisplayName,Id,CreationTime,ModificationTime

Script reader

Inspect before you run

Inspection only

Inspect the script below. It does not run in this browser.

Inspection only — no command has run.

    Show reference output
    1 DisplayName Id CreationTime ModificationTime
    2 ----------- -- ------------ ----------------
    3 Sample object 1001 9/10/2026 12:00:00 PM 9/10/2026 1:00:00 PM
    Inspect this example’s structure

    Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.

    Get-GPO -All | Select-Object DisplayName,Id,CreationTime,ModificationTime
    1. Stage 1Get-GPO-All
    2. Stage 2Select-ObjectPositional values or no named parameters

      How it works

      Get-GPO -All enumerates every policy object in the domain and the projection keeps the display name with its GUID and both timestamps. That GUID matters because display names are not unique, and the GUID is what shows up in gpresult output and in the SYSVOL folder layout.

      Adapting it

      Sort on ModificationTime and pipe into Where-Object to isolate policies untouched for years, which is the candidate list a cleanup project actually starts from.

      Requirements

      GroupPolicy module, which installs separately from the ActiveDirectory RSAT feature.

      If the result is unexpected

      A GPO is absent from the inventory or appears under an unexpected name.

      The query may target another domain, and display names are not stable identifiers.

      1. Confirm the domain and locate the policy by GUID as well as display name.

      Validate the result

      The expected GUID appears in the selected domain inventory.

      Keep the check reliable

      Store GPO GUIDs with names so renames do not look like removal and creation.

      Primary documentation

      PowerShell objects and pipelines documentation

      Continue
      Genie guideInventory GPOs

      Get-GPO -All enumerates every policy object in the domain and the projection keeps the display name with its GUID and both timestamps.