schedule backup for GPOs using a script


  • Hi,

    I need to create a scheduled task and run it on the Domain Controllers each night to backup the Group Policies using a script. The resultant GPO backup will be placed on a file server share. The GPO’s will be need to be kept on disk for 30 days after which they will be deleted as part of the scheduled task.

    Can you help me writing the script and how achieve the requirements above?

    Tuesday, January 3, 2017 12:53 PM


  • Two simplest ways to achieve this:

    • Modify the GPO backup script, so that when it places the new backup it checks the content of the folder and removes the backup(s) older than 30 days.
    • Add a second separate scheduled task that would once a day check the backup folder and remove backup items older than 30 days.

    I would say, that the second option is better, as it provides you additional control over the cleanup process.


    • Edited by Avendil Tuesday, January 3, 2017 1:32 PM
    • Marked as answer by AhmadJY Thursday, January 5, 2017 6:28 AM
    Tuesday, January 3, 2017 1:32 PM

All replies