Code Monkey home page Code Monkey logo

backup-gpos's Introduction

<#

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

#>

backup-gpos's People

Contributors

ewall avatar

Watchers

James Cloos avatar Pradeep Toluganti avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.