Domain policy management is one of critical task. We divide polices into multiple GPO depending upon our requirement.
PowerShell is one of the powerful tool we have now. In this article we will see how we can create reports for our GPO using PowerShell.
First step you need GroupPolicy available on your machine. It is part of Group Policy Management tools which is available as feature on our Windows Server.
Once you have installed this feature you have all cmdlets available which are required to manage GPO using PowerShell. You can check using command “Get-Command -Module GroupPolicy”
The cmdlet we are going to use in this article is “Get-GPOReport”
There are two formats in which you can extract the report, xml and html.
If you want to extract all the settings which there for all GPOs in your domain, you can use below command.
“Get-GPOReport -All -ReportType Html”
If you want to extract single GPO settings then you can use below command.
“Get-GPOreport -name <GPO name> -ReportType xml”
You can use GPO Guid instead of name if required.
If you want to create a custom report in which you need specific settings or you want to output data into csv then you need to extract report in xml and then play with the data.
To Store data in XML format you need to mark variable as XML in which you will store the data.
[XML]$report = Get-GPOreport -name <GPO name> -ReportType xml
You need knowledge of how to work with XML PS object in order to create the custom report.
I hope this is helpful.