In this episode we look at how you can Backup, Restore, and Import Group Policy Objects using Windows PowerShell and the cmdlets that come with the Group Policy module in the latest version of RSAT and the GPMC.
$dir = '\\server1\gpobackups'
# Backups
Get-GPO -All |Backup-GPO -Path $dir
Get-GPO remoting |Backup-GPO -Path $dir
#Restore
Restore-GPO -Path $dir -All
Restore-GPO -Path $dir -Name remoting
# Restore a GPO from a specific backup
$id = '00003D27-F9E6-4C59-BF69-938E5AE43D05'
Restore-GPO -Path $dir -BackupId $id
# Create a new GPO named remoting2
Import-GPO -Path $dir -BackupGpoName remoting -TargetName remoting2 -CreateIfNeeded
Brought to you by The Windows PowerShell Bible 2.0 and PowerShellGroup.Org