Import-GPO

Import Group Policy settings into a specified GPO from a GPO backup.

Syntax
      Import-GPO -BackupId Guid [-TargetGuid Guid] [-TargetName string] -Domain string
         [-CreateIfNeeded] [-MigrationTable string] [-Path string] [-Server string] [CommonParameters]

      Import-GPO [-BackupGpoName string] [-TargetGuid Guid] [-TargetName string] -Domain string
         [-CreateIfNeeded] [-MigrationTable string] [-Path string] [-Server string] [CommonParameters]

Key
   -BackupGpoName
         The display name of the backed-up GPO from which to import the settings. 

   -BackupId Guid
         The backup ID of a GPO backup. Use this to specify a particular version of a backed-up GPO.

   -CreateIfNeeded
         Create a new GPO from the backup if the specified target GPO does not exist.

   -Domain string
         The domain containing the GPOs to restore, requires a trust relationship if not the current domain.

   -MigrationTable
         Specifies the path to a migration table file. You can use a migration table to map security
         principals and UNC paths across domains.

   -Path string
         The path to the backup directory; for example, "C:\Backups" or "\\Server64\Backups".

   -Server string
         The name of the domain controller that should complete the operation.
         Specify either a fully qualified domain name (FQDN) or the host name.
         For example: 
         FQDN:      DomainController1.europe.ss64.com
         Host Name: DomainController1

   -TargetGuid Guid
         Specifies the GUID of the GPO into which the settings are to be imported.
         You must specify either the -TargetGuid or -TargetName.

   -TargetName string
         The display name of the GPO into which the settings are to be imported.
         You must specify either the -TargetGuid or -TargetName.

The current/default domain is that of the user that is running the session or, for startup and shutdown scripts, the computer.

Examples

Import the settings from the most recent backup of the GPO named "SS64" from the C:\GpoBackups directory and restore as DemoGPO:

PS C:\> Import-GPO -BackupGpoName SS64 -TargetName DemoGPO -path C:\Gpobackups

Import the settings from the specified backup in the C:\Gpobackups directory into a GPO that is named DemoGPO in the current domain. The -BackupId parameter is used to specify the GUID of the GPO backup to import:

PS C:\> Import-GPO -BackupId A641D730-F2E3-464C-B8C9-F64562C536AF -TargetName DemoGPO -path c:\Gpobackups -CreateIfNeeded

Import the settings from the specified backup in the C:\Gpobackups directory into a GPO named DemoGPO in the current domain. The -BackupId parameter is used to specify the GUID of the GPO backup to use.

PS C:\> Import-GPO -BackupId A641D730-F2EC-464C-B8C1-F50564C536AF -TargetName DemoGPO -path c:\Gpobackups -CreateIfNeeded

“Everybody thinks that when new technologies come along that they're transparent and you can just do your job well on it. But technologies always import a whole new set of values with them” ~ Brian Eno

Related PowerShell Cmdlets

Backup-GPO - Backup group policy objects (GPOs).
Restore-GPO - Restore one or all GPOs from a GPO backup.


 
Copyright © 1999-2024 SS64.com
Some rights reserved