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