PowerShell Genie

GroupPolicy module: setup and commands

Module 2 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn

Find Group Policy objects with Get-GPO and export evidence with Get-GPOReport before changing links, inheritance or enforcement.

Getting it

Arrives with RSAT. Use Install-WindowsFeature GPMC on Windows Server, or Add-WindowsCapability -Online -Name Rsat.GroupPolicy.Management.Tools on a client.

Examples

1PS> Get-GPO -All
Show reference output
1 DisplayName Id GpoStatus
2 ----------- -- ---------
3 Default Domain Policy 31b2f340-016d-11d2-945f-00c04fb984f9 AllSettingsEnabled
1PS> Get-GPResultantSetOfPolicy -ReportType Html -Path .\rsop.html
Show reference output
1 (No pipeline object output. The Group Policy report was generated at the requested path.)

What it is for

Reach for it to inventory GPOs, spot unlinked or empty policies, and generate an HTML or XML record for change control. Get-GPResultantSetOfPolicy answers the harder question of what actually applied to a given user and computer pair.

Typical tasks

  • List every GPO with creation and modification times
  • Find GPOs that have no links
  • Produce an HTML report for an audit trail
  • Read resultant set of policy for a target
  • Back up and restore policy objects
  • Compare one GPO across two domains

Check the installed version

1PS> Get-Module -ListAvailable GroupPolicy | Select-Object Name, Version, Path
2PS> Get-Command -Module GroupPolicy

Compare the module path and version with the session used by your scheduled task or automation account. Reach for it to inventory GPOs, spot unlinked or empty policies, and generate an HTML or XML record for change control. Get-GPResultantSetOfPolicy answers the harder question of what actually applied to a given user and computer pair.

Primary documentation

Active Directory PowerShell documentation

Continue
Genie guideGroupPolicy module: setup and commands

Find Group Policy objects with Get-GPO and export evidence with Get-GPOReport before changing links, inheritance or enforcement.