I first discussed GPMC in tip 6494 » Introducing the Group Policy Management Console.
The Group Policy Management Console Scripting Samples page contains:
The following is a description of the Group Policy Management Console (GPMC) scripting samples.
You can find the samples in the %programfiles%\gpmc\scripts directory after you install the GPMC.
The scripts can be executed from the command line.
The scripts echo output to the command window and should be executed using the CScript.exe application.
The following script samples address administrative tasks:
Backing up an Individual GPO Backing up the GPOs in a Domain Creating a Copy of a GPO Creating a New GPO Creating a Policy Environment Using an XML File Creating an XML File that Represents a Policy Environment Create Migration Table Deleting a GPO Grant Permissions for all GPOs in a Domain Importing a GPO Importing Multiple GPOs into a Domain Restoring a GPO Restoring All GPOs in a Domain Setting GPO Permissions Setting Permissions for all GPOs Linked to a Scope of Management Setting Permissions to Create GPOs Setting Policy-related Permissions on a SOM
There are also script samples that perform the following queries:
Listing All GPOs in a Domain Listing Disabled GPOs Listing GPO Information Listing GPOs at a Backup Location Listing GPOs by Policy Extension Listing GPOs by Security Group Listing GPOs Orphaned in SYSVOL Listing GPOs With Duplicate Names Listing GPOs Without Security Filtering Listing SOM Information Listing SOMs With Links to GPOs in External Domains Listing Unlinked GPOs in a Domain Printing the SOM Policy Tree Generate Reports for all GPOs Generate Reports for a GPO