- Script

This script backup all GPOs and your Scripts folder located in the sysvol share. It will be saved to a server in a folder named as the current date.
PowerShell
Edit|Remove
# GPOBackupV2.PS1   
# Script By: Tim Buntrock 
# Change $BackupShare = "\\server\f$\Backup\GroupPolicies" to your server path 
 
# Set backup share 
$BackupShare = "\\server\f$\Backup\GroupPolicies" 
 
Import-Module grouppolicy 
# set date format 
$date = get-date -format d.M.yyyy 
# create folder based on date 
New-Item -Path $BackupShare\$date -ItemType directory 
# backup all gpos to the specified backup share 
Backup-Gpo -All -Path $BackupShare\$date 
 
# get domain infos 
$section = "search" 
import-module activedirectory 
$domobj = get-addomain 
$dom = $domobj.dnsroot 
$domdn = $domobj.distinguishedname 
 
# copy scripts folder content to the backup share 
copy-item \\$dom\sysvol\$dom\scripts -destination $BackupShare\$date\scripts -recurse -force 
 
- Run this script using a schedule task

Open the Task Scheduler on your server.
Right-Click on "Task Scheduler Library" and select "Create a Basic Task".
Define a Name/Description, Trigger...
On the "Action" section you have to select Start a Program and enter the following options.
Program/script: powershell
Add arguments (optional): -file "C:\admin\Scripts\GPOBackup\GPOBackupV2.ps1"
On the "Finish" section checking "Open the Properties dialog for this task when I click Finish" and click "Finish".
To run whether user is logged on or not, select the option in the General tab, click ok and enter credentials.
- Import GPO Backups
To import the backed up GPOs you can use the GPMC:
Right-click "Group Policy Objects" and click on "Manage Backups..."
or using the powershell command import-gpo:
https://technet.microsoft.com/de-de/library/ee461044.aspx