gpo-report

Hello!

I try to extract an html-report for every GPO I have in my domain separately but I do not succeed. Here is my command

get-gpo -all | select displayname | % {Get-GPOReport -Name $_.displayname -ReportType Html -path “c:\temp($Displayname).html”}

Where is my fault?

Thank you

You correctly referenced $_.displayname for -Name but later incorrectly use $displayname. Also, sometimes displayname can have characters present that are not allowed in a filename. You may want to reconsider and use ID instead. You also don’t need the select displayname, it isn’t adding anything.

Get-Gpo -All | foreach {Get-GPOReport -Name $_.Displayname -ReportType Html -path "c:\temp\$($_.Displayname).html"}

or

Get-Gpo -All | foreach {Get-GPOReport -guid $_.id -ReportType Html -path "c:\temp\$($_.id).html"}

Thank you very much, works fine now