Restore-GPO with -BackupId parameter recreates missing GPO but documentation says that should fail
Opened this issue · 1 comments
The Description section of the Restore-GPO documentation says, "if the GPO no longer exists in the domain, the cmdlet fails." I find that's true if I identify the GPO with the -Name or -Guid parameters. But using the -BackupId parameter works, it recreates a missing GPO. Is this intended and reliable functionality that I can depend on?
I observed this on a Windows Server 2019 domain controller in a Windows Server 2016 domain. The domain only has one DC and the commands were run locally on the DC so I don't think I'm getting a false result due to replication delays or other factors. This is with PowerShell 5.1 and version 1.0.0.0 of the GroupPolicy PowerShell module. To reproduce, either run Restore-GPO with the -BackupId parameter or pass a GpoBackup object to Restore-GPO through the pipeline, for example, given a GPO "Test GPO":
$Backup = Backup-GPO -Name "Test GPO" -Path <backup path>
Remove-GPO -Name "Test GPO"
# Calling Restore-GPO with -Name parameter gives "GPO was not found" exception, consistent with documentation.
Restore-GPO -Name "Test GPO" -Path <backup path>
# Also GPO not found using -Guid parameter, consistent with documentation
Restore-GPO -Guid "<GPO Guid>" -Path <backup path>
# This works, using -BackupId parameter, contrary to documentation, and this also works with the string literal of the backup Id.
Restore-GPO -BackupId $Backup.Id -Path <backup path>
# This works too
$Backup | Restore-GPO
The above works with and without removing the GPO, but my question is in the case of removing the GPO, Restore-GPO works when the documentation says it would fail, but only with the -BackupId parameter. Thank you very much.
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
- ID: c93a37fb-a7f2-025a-90d6-a48e1bf1e6b1
- Version Independent ID: e23abbeb-19ae-469f-a24f-7ae35e26d229
- Content: Restore-GPO (GroupPolicy)
- Content Source: docset/winserver2022-ps/grouppolicy/Restore-GPO.md
- Product: w10
- GitHub Login: @JasonGerend
- Microsoft Alias: jgerend
To make it easier for you to submit feedback on articles on learn.microsoft.com, we're transitioning our feedback system from GitHub Issues to a new experience.
As part of the transition, this GitHub Issue will be moved to a private repository. We're moving Issues to another repository so we can continue working on Issues that were open at the time of the transition. When this Issue is moved, you'll no longer be able to access it.
If you want to provide additional information before this Issue is moved, please update this Issue before December 15th, 2023.
With the new experience, you no longer need to sign in to GitHub to enter and submit your feedback. Instead, you can choose directly on each article's page whether the article was helpful. Then you can then choose one or more reasons for your feedback and optionally provide additional context before you select Submit.
Here's what the new experience looks like.
Note: The new experience is being rolled out across learn.microsoft.com in phases. If you don't see the new experience on an article, please check back later.
First, select whether the article was helpful:
Then, choose at least one reason for your feedback and optionally provide additional details about your feedback:
| Article was helpful | Article was unhelpful |
|---|---|
![]() |
![]() |
Finally, select Submit and you're done!


