Skip to content
Menu

Back up All GPOs With HTML Reports

Backs up all GPOs with an HTML report each into a dated folder, skips unchanged days, and prunes its own old backups to the number you keep. Never changes a GPO. Schedule it daily.

Back up all GPOs with HTML reports is free for members.

Enter your email to create your free account and get the file.

We'll email you the script and the weekly MSP Outpost email. Unsubscribe anytime. Privacy policy.

Already a member? Sign in.

Be the first to review Back up all GPOs with HTML reports. Tell other MSPs how it worked for you.

Write a Review

LanguagePowerShell
Runs onWindows Server 2016+ (DC, or a member with GPMC); runs as SYSTEM
NeedsPowerShell 5.1, administrator rights, GroupPolicy module (GPMC), rights to read all GPOs
Changes thingsChanges what it runs on

What It Does

The script reads every GPO with its modification time and version numbers and compares them with the newest backup it made. When nothing was added, removed or changed it ends OK with Already backed up. ForceBackup=true backs up anyway. Otherwise it makes a folder named for the UTC time under BackupFolder, runs Backup-GPO for all GPOs into it, and, unless IncludeReports is false, writes one HTML report per GPO.

It then checks that the backup holds one folder per GPO, a manifest, and one report per GPO, and only then writes a small marker file that says the folder is complete and records what was backed up, which is what the next run compares with. An incomplete backup is not marked, and is never used or pruned.

Finally it deletes the oldest backups so that KeepBackups remain. Only folders named like a dated backup that hold its own marker file are deleted. Anything else in BackupFolder is left alone. It never changes a GPO, and changes nothing outside the backup folder. DryRun lists what it would back up and delete.

BackupFolder defaults to a folder under the MSP Outpost data folder on the machine that runs it. That folder is readable by local users, and a GPO can hold scripts or settings you want kept private, so point BackupFolder at a protected folder or share. Copy backups off the server: a backup on the machine it protects is not a backup.

Before You Run It

  • Run it on a domain controller or a member server with the Group Policy Management feature (GPMC) and rights to read all GPOs.
  • Set BackupFolder to a protected folder or share, preferably not on the system drive.
  • Plan how the backups get off this server. This script does not copy them anywhere.
  • Run it with DryRun=true first, then schedule it daily. Unchanged days cost almost nothing.

Type and Risk

  • Type: Action. It makes its change, checks the change worked and says what changed. It exits 0, or 2 when it could not do the job.
  • Risk: Low. Set DryRun=true, or run it with -WhatIf, to list every change without making any.
  • What it changes: Creates a dated backup folder with the GPO backups and HTML reports, and deletes this script's own backups beyond KeepBackups.
  • Restart: It never restarts the machine.
  • Typical run: Under 2 minutes for 100 GPOs.
  • Example answer: "Backed up 24 GPO(s) with 24 HTML report(s) to 20261119-020000; kept 14 backup(s), removed 1 old"
  • Tested before listing on a Windows Server 2025 domain controller (VM) with Windows PowerShell 5.1, run as SYSTEM, against its own test cases.

Inputs

Pass an input as an argument (-Name value), as an environment variable with the same name, which is how most RMMs pass script variables, or change its default in the param() block at the top of the script. An argument wins over an environment variable, which wins over the default.

  • BackupFolder: The folder that holds the dated backups. Absolute path. Default empty: %ProgramData%\MSPOutpost\GpoBackups. Created when missing.
  • KeepBackups: How many dated backups to keep (this one included). Whole number 1 to 365. Default 14.
  • IncludeReports: true to write an HTML report per GPO. Default true.
  • ForceBackup: true to back up even when no GPO changed since the last backup. Default false.

Every script also takes DryRun, OutputFormat (Text, Answer, Json or Csv), ExportPath and ResultField, which writes the answer to an RMM custom field.

License

Provided "as is" under the MIT License, without warranty of any kind. Test before production use. MSP Outpost and User First Digital Inc. accept no liability for any damage or loss.

The Script

invoke-gpo-backup.ps1 · 917 lines · 48 KB

Free for Members

Create a free account or sign in to read, copy and download this script.

Welcome Back

Sign in to your MSP Outpost account.