Group Policy Backup

Group policies are one of the most important instruments of administering windows machines which are part of the domain. Most of the bulk settings and configurations are applied via them. What is more, they are so powerful and may cause catastrophic results if misconfigured.

Besides, there are some policies that have more than 100 settings set (Don’t get angry with me, there exists policies like IE configurations. We do not divide them into small parts usually.) and it is not so easy to keep track of the changes to revert in case of disaster.

As a result, you backup your group policies

periodically

and know how to restore them if needed!

Import-Module GroupPolicy

$Date = Get-Date -UFormat "%Y-%m-%d"
$BackupPath = $Env:HOMEPATH + "\Desktop\" + $Date

New-Item -ItemType Directory -Path $BackupPath -Force

#Backup-GPO -All -Path $BackupPath
Backup-GPO -Name "test" -Path $BackupPath

For detailed info, please check this link:
https://technet.microsoft.com/en-us/library/cc754760(v=ws.11).aspx

Note:
In GPO restore, group policy links are NOT restored. If group policy is deleted accidentally, backup method above does not give you the whole rescue. To manage this, group policy links should also be backed up. I had written a script getting all group policies with their links and writing them to a file in the format GPO-name@GPO-link. The rest was easy, read the file, parse the @ and add GPO-name to GPO-link. Because the script is not available for now, I can advise you checking powershell group policy cmdlets here.
This script can also be checked.

Advertisements