9.17. Backing Up a GPO

Problem

You want to back up a GPO.

Solution

Using a graphical user interface

  1. Open the GPMC snap-in.

  2. In the left pane, expand the Forest container, expand the Domains container, browse to the domain of the GPO you want to back up, and expand the Group Policy Objects container.

  3. Right-click on the GPO you want to back up, and select Back Up.

  4. For Location, enter the folder path to store the backup files.

  5. For Description, enter a descriptive name for the backup.

  6. Click the Back Up button.

  7. You will see a progress bar and status message that indicates if the back up was successful.

  8. Click OK to exit.

Using a command-line interface

> backupgpo.wsf "<GPOName>" "<BackupFolder>" /comment:"<BackupComment>"

Using VBScript

' This code backs up a GPO to the specified backup location.
' ------ SCRIPT CONFIGURATION ------
strGPO      = "<GPOName>"        ' e.g. Default Domain Policy
strDomain   = "<DomainDNSName>"  ' e.g. rallencorp.com
strLocation = "<BackupFolder>"   ' e.g. c:\GPMC Backups
strComment  = "<BackupComment>" ' e.g. Default Domain Policy Weekly ' ------ END CONFIGURATION --------- set objGPM = CreateObject("GPMgmt.GPM") set objGPMConstants = objGPM.GetConstants( ) ' Initialize the Domain object set objGPMDomain = objGPM.GetDomain(strDomain, "", objGPMConstants.UseAnyDC) ' Find the GPO you want to back up set objGPMSearchCriteria = objGPM.CreateSearchCriteria objGPMSearchCriteria.Add objGPMConstants.SearchPropertyGPODisplayName, _ objGPMConstants.SearchOpEquals, cstr(strGPO) set objGPOList = ...

Get Active Directory Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.