Nice old trick, Create reports of Group Policy Objects

Posted by

Just a quick post of how to create HTML or XML reports of your Group Policy Objects with PowerShell.

First make sure you are logged onto a host where the Group Policy Management, GPMC, and Active Directory Cmdlets are installed.

First define the logged on current domain

$domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()

To create the reports use Get-GPOReport command, this command can create HTML or XML reports and this configured with the –ReportType parameter

Now here are two commands, either all GPOs or filtered by GPO display name. Don’t forget to change –Path to your preferred directory

Get-GPO -Domain $Domain.Name -All | foreach { Write-Host “$($_.DisplayName) ($($_.Id))”; Get-GPOReport -ReportType Html -Id $_.Id -Path “C:\GpoReport\$($_.DisplayName).html” }

And this will filter out the GPO’s starting with an Domain*

Get-GPO -Domain $Domain.Name -All | Where { $_.DisplayName -like “Domain*” } | foreach { Write-Host “$($_.DisplayName) ($($_.Id))”; Get-GPOReport -ReportType Html -Id $_.Id -Path “C:\GpoReport\$($_.DisplayName).html” }

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.