Backup Group Policy Objects through PowerShell

Today one of my tasks was to remove some group policies.
Before I delete those, I always create a backup. Since the list of GPO’s was quite extensive, I turned to PowerShell.
Note that depending on your PowerShell version you may need to import the GroupPolicy module first by running:

1

Import-Module GroupPolicy

Now that’s done, I create a file with all the names of the GPO’s in there. You could type it manually, but I use PowerShell again.
To get the names of all the Group Policy Objects and put that list in the clipboard:

1

Get-GPO-All|Select-Object-ExpandProperty DisplayName|clip.exe

Now paste this list into a textfile and remove the ones you don’t want to create a backup from.