# Get a GPO report for each policy | output separate for each OBject.HTML

**URL:** <https://forums.powershell.org/t/get-a-gpo-report-for-each-policy-output-separate-for-each-object-html/16410>\
**Category:** PowerShell Help\
**Created:** [May 3, 2021, 3:44pm UTC](https://forums.powershell.org/t/get-a-gpo-report-for-each-policy-output-separate-for-each-object-html/16410 "2021-05-03T15:44:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsamson](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@jsamson](https://forums.powershell.org/u/jsamson)\
**Post date:** [May 3, 2021, 3:44pm UTC](https://forums.powershell.org/t/get-a-gpo-report-for-each-policy-output-separate-for-each-object-html/16410/1 "2021-05-03T15:44:55Z")

</div>

Hi guys, Im stuck in creating a gpo report-all ;  
I want to separate all generated policy report in a folder .

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [May 3, 2021, 4:03pm UTC](https://forums.powershell.org/t/get-a-gpo-report-for-each-policy-output-separate-for-each-object-html/16410/2 "2021-05-03T16:03:07Z")

</div>

jsamson,  
Welcome to the forums.

> [@jsamson](#):
>
> Im stuck in creating a gpo report-all

Where exactly did you get stuck? Please share your code. (formatted as code please 😉 )

---

<div class="post-metadata">

**Author:** ![jsamson](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@jsamson](https://forums.powershell.org/u/jsamson)\
**Post date:** [May 3, 2021, 5:32pm UTC](https://forums.powershell.org/t/get-a-gpo-report-for-each-policy-output-separate-for-each-object-html/16410/4 "2021-05-03T17:32:30Z")

</div>

Hi Olaf, Im stuck with this  
$g = get-gpo -all  
Get-GPOReport -name $g.displayname -ReportType html

I want to create a html file for all of my policies separately then store it in a folder.

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [May 3, 2021, 11:34pm UTC](https://forums.powershell.org/t/get-a-gpo-report-for-each-policy-output-separate-for-each-object-html/16410/5 "2021-05-03T23:34:12Z")

</div>

… why twice? 😉

Could you please format your code as code here in the forum? Thanks in advance.

Don’t you get error messages when you run this code? If you get error messages you should post them here as well. Post them completely and formatted as code as well, please.

When you carefully read the help for …

> **[Get-GPOReport (GroupPolicy)](https://docs.microsoft.com/en-us/powershell/module/grouppolicy/get-gporeport?view=windowsserver2019-ps)**
>
> Use this topic to help manage Windows and Windows Server technologies with Windows PowerShell.

… you will see that the paramters “`-Name`” and “`-GUID`” only take single values. Your variable “`$g`” on the other hand is an array. That’s why you need to use a loop to provide one single element at a time for Get-GPOReport.

So you may read the help for

> **[ForEach-Object (Microsoft.PowerShell.Core) - PowerShell](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/foreach-object?view=powershell-7.2&viewFallbackFrom=powershell-7.1)**
>
> The ForEach-Object cmdlet performs an operation on each item in a collection of input objects. The input objects can be piped to the cmdlet or specified using the InputObject parameter. Starting in Windows PowerShell 3.0, there are two different ways...

and

> **[about Foreach - PowerShell](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_foreach?view=powershell-7.2&viewFallbackFrom=powershell-7.1)**
>
> Describes a language command you can use to traverse all the items in a collection of items.

as well to learn how to use loops. Please always read the help completely including the examples.

You may also read the help for

> **[Out-File (Microsoft.PowerShell.Utility) - PowerShell](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/out-file?view=powershell-7.2&viewFallbackFrom=powershell-7.1)**
>
> The Out-File cmdlet sends output to a file. It implicitly uses PowerShell's formatting system to write to the file. The file receives the same display representation as the terminal. This means that the output may not be ideal for programmatic...

to be able to export your reports into files.

---

<div class="post-metadata">

**Author:** ![jsamson](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@jsamson](https://forums.powershell.org/u/jsamson)\
**Post date:** [May 4, 2021, 4:01am UTC](https://forums.powershell.org/t/get-a-gpo-report-for-each-policy-output-separate-for-each-object-html/16410/6 "2021-05-04T04:01:44Z")

</div>

Thank you olaf, will read it… yes there’s an error on it… but what i want to say is what I want to do… anyway, I’ll read the documents you’ve sent… thank you

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:26pm UTC](https://forums.powershell.org/t/get-a-gpo-report-for-each-policy-output-separate-for-each-object-html/16410/7 "2024-05-16T20:26:31Z")

</div>


