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” }

Advertisements