Group Policy Management Console Sample Scripts

The Group Policy Management Console (GPMC) provides a comprehensive set of COM interfaces that you can use to script many of the operations supported by the console. This download contains a set of sample scripts that make use of these interfaces.

These sample scripts can be used with the Windows Server 2008, Vista and earlier versions of GPMC. As with all samples, remember to test them before applying the scripts to your environment.


This download will copy the GPMC sample scripts to the %programfiles%Microsoft Group PolicyGPMC Sample Scripts folder.

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

For more information about using the GPMC sample scripts please see,

Judith Herman, Group Policy Programming Writer


Comments (2)

  1. Kevin Remde says:

    Has anyone created PowerShell versions of these yet?

Skip to main content