Using Group Policy Management Console Class Library

This section includes step-by-step “how to” samples written in Microsoft Visual C# that illustrate how to use various classes and types from this library to accomplish a specific Group Policy Management Console (GPMC) task, such as backing up a Group Policy object (GPO), restoring GPOs, and so on. Additionally, most of the samples in this section include stand-alone code that can be run independently or pasted into a larger application and modified to the requirements of the application.

In This Section

Sample Description and Main GPMC Classes Used

How to Back Up All GPOs in a Domain

Illustrates how to back up all GPOs in the current domain using the GPDomain, GpoCollection, and Gpo classes.

How to Restore a Domain's GPOs

Shows how to restore a domain’s GPOs that have been backed up previously using the GPDomain, BackupDirectory, GpoBackupCollection, and GPSearchCriteria classes.

How to Import GPOs from a Backup

Iillustrates using the GPMC Class Library to import a Group Policy object's (GPO) settings from a backed-up GPO using the GPDomain, GPSearchCriteria, BackupDirectory, and GpoBackupCollection classes.

How to List Unlinked GPOs in a Domain

Demonstrates using the GPMC Class Library to list all unlinked GPOs for a specified domain using the GPDomain, GPSearchCriteria, and SomCollection classes.