-
Notifications
You must be signed in to change notification settings - Fork 1
ewall/Backup-GPOs
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
<# Backup-GPOs.ps1 -- by Eric Wallace <[email protected]>, December 2011 .SYNOPSIS Automated backup of Group Policy objects. .NOTES This script must be run from an account with Domain Admins permissions on the target domain(s). .PARAMETER domainLst Domain name, or a list of domain names separated by commas only (no spaces!) .PARAMETER searchTxt A word or part of a word that should be in the GPO's display name. If you use this search option, only the GPOs matching this term will be backed up. .PARAMETER backupDir Directory for saving the GPO backups. The folder structure will be created automatically. .PARAMETER daysOld The script can automatically delete any backups older than the given number of days. The default is to disable cleanup, or you can set this option to 0 days which will also disable the cleanup. .EXAMPLE (Parameters can be listed in order, or by using optional named parameter flags shown in brackets. Text must be in quotes if it contains spaces, otherwise quotes are unnecessary.) Backup all GPOs from the current user's domain to the default location: .\Backup-GPOs.ps1 Backup all GPOs for multiple domains: .\Backup-GPOs.ps1 [-domainLst] mehealth.org,mmcf.mehealth.org,mhr.mehealth.org Backup only GPOs with the word "test" in their name: .\Backup-GPOs.ps1 [-domainLst] mmcf.mehealth.org [-searchTxt] test Backup defaults except to a specific directory (remember to use quotes if it contains spaces): .\Backup-GPOs.ps1 -backupDir C:\My_GPO_Backups Use defaults, except cleanup backup folders older than 15 days: .\Backup-GPOs.ps1 -daysOld 15 Use defaults, except disable cleanup of old backup folders by specifying 0 days' retention (default): .\Backup-GPOs.ps1 -daysOld 0 All parameters specified positionally (note that here the search term is blank): .\Backup-GPOs.ps1 mmcf.mehealth.org "" C:\GPOBackups 15 .HISTORY - 2011-07-07 version 0.1 - created during PowerShell class - 2011-12-22 version 0.2 - most core features implemented - 2011-12-23 version 0.3 - added support for multiple domains - 2012-01-13 version 0.4 - added support to delete older backups .TODO ƒ allow input of target domain(s) ƒ new folder structure: domain name | GPO display name | backup date ƒ put HTML reports in 2nd-level folder (GPO display name) ƒ document parameters and examples - tweak output for sanity when running as background job, perhaps using t-logs? .WISHLIST ƒ allow search criteria, e.g. to backup only GPOs beginning with a certain prefix ƒ backup multiple domains in one execution ƒ delete backups older than X days X backup forest root and all child domains in one execution? --> rejected X zip/compress the backup dirs? --> rejected #>
About
Flexible PowerShell script to make file-based backups of Active Directory's Group Policy Objects.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published