Exporting Group Policy Object settings to a file can be used when you need to move a GPO to another forest, create a backup copy of configured policies, or get a handy HTML report of policy settings for further analysis. In this article, we’re going to show you how to export all Group Policies settings to a file or to an HTML report.
The Group Policy Management Console (GPMC.msc), which is included with the Remote Server Administrative Tools for Windows (RSAT), only allows you to backup GPOs in your Active Directory domain/forest.
In the console, right-click on the GPO you want and select Back up.
All policy settings including GPO permissions, GUIDs, WMI filter links will be saved to the specified folder. From this backup, you can later restore the GPO settings.
Referer. Check our post on how to deploy printers to users or computers via Group Policy.
The PowerShell GroupPolicy module can also be used to back up GPO settings.
Import-Module GroupPolicy
Backup-GPO -Name "gpoEnableFSAudit" -Path "C:\Backup" -Comment "Backup gpoEnableFSAudit $(get-date)"
You can export all the GPOs in a domain to a folder:
Backup-GPO -All -Path "C:\Backup"
To export GPO settings to a CAB file, you can use Microsoft Advanced Group Policy Management (AGPM), which extends the capabilities of the standard GPMC.
Note. AGPM is included in the Microsoft Desktop Optimization Pack (MDOP), which is available as an additional subscription for Software Assurance customers.
- Install AGPM 4.0 SP3 on the computer with GPMC;
- Open the Group Policy Management Console and navigate to the Change Control section;
- Right-click on the GPO on the Contents tab and select Export to;
- Specify the name of the file you want to export the GPO to.
You can export GPO settings to an HTML file. This HTML file is similar in appearance and structure to the resulting Group Policy Settings report that you can generate on any Windows computer using the gpresult tool.
Note. Learn how to add and edit Registry keys using GPO.
For example, to obtain an HTML report with the Default Domain Controllers Policy settings, run the command:
Get-GPOReport -Name 'Default Domain Controllers Policy' -ReportType 'HTML' -Path 'C:\ps\defaultDCgpo-Report.html'
You can now view all your GPO settings in the browser. If you need to find a specific configured parameter or value, use the browser’s built-in page search.
A similar HTML policy report file can also be generated from within the GPMC GUI. Right-click on the GPO, select Save Report, and specify the HTML file name.
You can create an HTML report and export the settings of all the GPOs in the domain to this file. This is useful if you need to find a particular policy or value without iterating through the GPOs in the domain.
Get-GPOReport -All -ReportType HTML -Path "C:\PS\AllGPOs.html"
You can also use the PowerShell cmdlet to export GPO settings to XML format. You must specify the -ReportType Xml argument to do this.
[xml]$GpoXml = Get-GPOReport -Name 'Default Domain Controllers Policy' -ReportType Xml
Now you can get any GPO properties or settings with PowerShell. For example, to list the Organizational Unit (OU) to which a GPO is linked to:
$GpoXml.GPO.LinksTo
Or view the date the GPO was created and last modified:
$GpoXml.GPO | Select-Object CreatedTime,ModifiedTime