Windows Server 2008

Exporting and Importing Group Policy Objects – Windows Server 2008

There may be times when it is useful to use an existing Group Policy Object (GPO) as a template for a GPO on another server, or perhaps you just need to perform a GPO backup and restore. Here is how to export and import GPOs from the command line.

Starting the Group Policy Cmdlet in Powershell

Firstly, from the command line start powershell and import the Group Policy Cmdlet:

powershell
import-module grouppolicy

Exporting a GPO

Check that the backup directory you wish to use exists. If not, create it.

Powershell command:

Backup-GPO -Name <GPOName> -Path <BackupDirectoryPath>

Example: to backup a GPO called “Example GPO” to the directory “C:\GPOBackup”

Backup-GPO -Name "Example GPO" -Path "C:\GPOBackup"

Importing a GPO

Keeping the same GPO Name

Powershell command:

Import-GPO -BackupGPOName <GPOName> -CreateIfNeeded -Path <BackupDirectoryPath>

Example: to import a GPO called “Example GPO” from the directory “C:\GPOBackup”

Import-GPO -BackupGPOName "Example GPO" -CreateIfNeeded -Path "C:\GPOBackup"

Renaming the GPO

Powershell command:

Import-GPO -BackupGPOName <GPOName> -TargetName <NewGPOName> -CreateIfNeeded -Path <BackupDirectoryPath>

Example: to import a GPO called “Example GPO”, renaming it to “New GPO”, from the directory “C:\GPOBackup”

Import-GPO -BackupGPOName "Example GPO" -TargetName "New GPO" -CreateIfNeeded -Path "C:\GPOBackup"

4 thoughts on “Exporting and Importing Group Policy Objects – Windows Server 2008”

  1. Do you mind if I quote a few of your articles as long as I provide credit and sources back to your weblog?
    My blog site is in the very same niche as yours and my users would definitely benefit from a lot of the information you
    provide here. Please let me know if this ok with you.
    Thanks!

    1. Hi, sorry for my slow response. Quoting and crediting my posts is no problem, I’m glad they are useful!
      Hannah

  2. Hello Hannah,

    Any thoughts on executing this in Windows 10?
    Could I use this to change a GPO according to day of the week?

    Thank you!

    1. Hi Jan. Hope you found the answer to your question. I’m out of the Windows Server game at the moment and have been for a while so unfortunately I can’t be much help. Good luck!

Leave a Reply

Your email address will not be published. Required fields are marked *