PowerShell - Get GPO Details as HTML

import-module grouppolicy

# Setting file variables, local folders or UNC shares are permitted.

$path = 'C:\temp'

#$domain = Get-ADDomain

$GPOs = Get-GPO -all -server CS8ADC01


# Backup the GPOs

# Backup-Gpo -All -Path $path


# Generating HTML reports

$GPOs | ForEach-Object {

$dname = $_.DisplayName

Get-GPOReport -name ($dname) -ReportType Html -Path "C:\temp\$dname.html"}

#Get-GPOReport -name ("CPN Installer") -ReportType Html -Path "C:\temp\CPN Installer.html"

Creates as UTF16. Using the TYPE command you can make it UTF8 and grep will be happy and search

for %f IN (*.html) DO @echo "%f" >> out.txt & type "%f"|grep -c -i "Deployment source" >> out.txt