Exporting and Importing Group Policy Objects via PowerShell

Start powershell and import the Group Policy Cmdlet:

powershell

import-module grouppolicy

Exporting GPO’s

Specific GPO

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”

All GPO’s

Backup-GPO -All -Path <BackupDirectoryPath>

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

Backup-GPO -All -Path “C:GPOBackup”

 

Importing GPO’s

Keep GPO Name

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”

New GPO Name

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”

Advertisement
%d bloggers like this: