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
https://msdn.microsoft.com/en-us/library/aa814151(v=vs.85).aspx