Backup individual group policy objects (GPOs) or all the GPOs in a domain.
Syntax Backup-GPO [-Name] string -Path string [-Comment string] [-Domain string] [-Server string] [CommonParameters] Backup-GPO -All -Path string [-Comment string] [-Domain string] [-Server string] [CommonParameters] Backup-GPO -Guid <Guid> -Path string [-Comment string] [-Domain string] [-Server string] [CommonParameters] Key -All Backup all GPOs in the domain. -Comment string Include a comment for the backed-up GPO. -Domain string The domain containing the GPOs to backup, requires a trust relationship if not the current domain. -Guid Guid Specify the GPO to backup by its globally unique identifier (GUID). -Name string Specify the display name of the GPO to backup. -Path string The path to the backup directory; for example, "C:\Backups" or "\\Server64\Backups". -Server string The name of the domain controller that should complete the operation. Specify either a fully qualified domain name (FQDN) or the host name. For example: FQDN: DomainController1.europe.ss64.com Host Name: DomainController1 CommonParameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable, -OutBuffer -OutVariable.
The current/default domain is that of the user that is running the session or, for startup and shutdown scripts, the computer.
Examples
Back up the "SS64" GPO to the C:\GpoBackups directory:
PS C:\> Backup-Gpo -Name SS64 -Path C:\GpoBackups -Comment "Weekly Backup"
Back up the GPO with the specified GUID:
PS C:\> Backup-Gpo -GUID 3a4a6473-6b2a-4c84-ab78-175e68d64bdf -Domain ss64.com -Server DC1 -Path \\Server64\GpoBackups
Back up all the GPOs in the current domain to \\Server64\GpoBackups:
PS C:\> Backup-Gpo -All -Path \\Server64\GpoBackups
“I have a very strict gun control policy: if there's a gun around, I want to be in control of it” ~ Clint Eastwood
Related PowerShell Cmdlets:
Restore-GPO - Restore one or all GPOs from a GPO backup.
Import-GPO - Import Group Policy settings into a specified GPO from a GPO backup.
Copy-CPO - Copy a Group Policy Object.