How to backup and restore Group Policy Objects in Active Directory using PowerShell scripts?
Read on to know how to backup and restore Group Policy Objects (GPO) with PowerShell scripts in Active Directory (AD) and how you can get it done easily with ADManager Plus.
Windows PowerShell
Backing up GPOs:
- Identify the domain for which the GPOs need to be backed up.
- Create and compile the script for backing up GPOs. Execute the script in PowerShell.
- Sample script for backing up the GPOs:
Copied
PS C:\> Backup-Gpo-All-Path "C:\Users\Administrator\Documents\Scripts"
Click to copy entire script
Restoring GPOs:
- Identify the domain for which the GPOs need to be backed up.
- Create and compile the script for backing up GPOs. Execute the script in PowerShell.
- Sample script for restoring GPOs in Active Directory:
Copied
PS C:\> Restore-Gpo -Name "Admins" -Path "C:\Users\Administrator\Documents\Scripts"
Click to copy entire script
ADManager Plus
Backing up GPOs:
- Navigate to Backup> Settings > Backup Settings .
- Select the GPOs and the frequency at which you want the backups to occur. Then click save.
- You can even export the reports as CSV, PDF, XLSX or HTML.
Screenshot
Restoring GPOs:
- Navigate to Backup> Active Directory > Restore.
- Select the GPO(s) you wish to restore. Then click Restore.
Screenshot
» Start 30-day Free Trial
Although backing up and restoring GPOs with native tools like PowerShell looks simple, it comes with a few limitations:
- PowerShell script can be run only from the computers which have the Active Directory Domain Services role installed in them.
- Need for a new script, in case other AD objects need to be backed up or restored needs to be exported.
- The syntax, parameters and iterations need to be correct. A typo or incorrect syntax might be difficult to spot and rectify, especially when the script is a long one.
ADManager Plus lets you perform the same with a few clicks from its web based GUI console. It also lets you restore AD objects even after their tombstone period.