Restore one or all GPOs in a domain from a GPO backup.
Syntax Restore-GPO -All -Path string [-Domain string] [-Server string] [-Confirm] [-WhatIf] [CommonParameters] Restore-GPO -BackupId Guid -Path string [-Domain string] [-Server string] [-Confirm] [-WhatIf] [CommonParameters] Restore-GPO -Guid Guid -Path string [-Domain string] [-Server string] [-Confirm] [-WhatIf] [CommonParameters] Restore-GPO [-Name] Name -Path string [-Domain string] [-Server string] [-Confirm] [-WhatIf][CommonParameters] Key -All Restore all GPOs in the domain that have backups in the backup directory. Each GPO is restored from its most recent backup in the directory. -BackupId Guid The backup ID of a GPO backup. The backup ID is a globally unique identifier (GUID) that uniquely identifies the backup. -Domain string The domain in which you want to restore the GPO, requires a trust relationship if not the current domain. -Guid Guid Specifies the GPO to restore by its globally unique identifier (GUID). -Name Name Specifies the GPO to restore by its display name. The GPO is restored from its most recent backup in the backup directory. To specify an older backup, use -BackupId. -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 -Confirm Prompt for confirmation before executing the command. -WhatIf Describe what would happen if you executed the command without actually executing the command. 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
Restore the GPO named SS64 from the \\Server64\Backups directory. The most recent backup is restored:
PS C:\> Restore-GPO -Name "SS64" -Path \\Server64\Backups
Restore the GPO with the given GUID from the \\Server64\Backups directory. The most recent backup is restored:
PS C:\> Restore-GPO -GUID fa4a6473-6a2a-4b87-ab78-164e68d94bce -Path \\Server64\Backups
Restore all of the GPOs in the ss64.com domain previously backed up to \\Server64\Backups. Each GPO is restored using its most recent backup.
PS C:\> Restore-GPO -All -Domain ss64.com -Path \\Server64\Backups
“I have to be alone very often. I'd be quite happy if I spent from Saturday night until Monday morning alone in my apartment. That's how I refuel” ~ Audrey Hepburn
Related PowerShell Cmdlets:
Backup-GPO - Backup group policy objects (GPOs).
Import-GPO - Import Group Policy settings into a specified GPO from a GPO backup.