PowerShell Logo Small

Copy-GPO



This is the built-in help made by Microsoft for the command 'Copy-GPO', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Copies a GPO.

SYNTAX


Copy-GPO [-CopyAcl] [-MigrationTable <String>] [-SourceDomain <String>] [-SourceDomainController <String>] [-TargetDomain <String>] [-TargetDomainController <String>]
-SourceGuid <Guid> -TargetName <String> [-Confirm] [-WhatIf] [<CommonParameters>]
Copy-GPO [-SourceName] <String> [-CopyAcl] [-MigrationTable <String>] [-SourceDomain <String>] [-SourceDomainController <String>] [-TargetDomain <String>]
[-TargetDomainController <String>] -TargetName <String> [-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Copy-GPO cmdlet creates a (destination) GPO and copies the settings from the source GPO to the new GPO. The cmdlet can be used to copy a GPO from one domain to another
domain within the same forest. You can specify a migration table to map security principals and paths when copying across domains. You can also specify whether to copy the
access control list (ACL) from the source GPO to the destination GPO.


Note: Copy-GPO will not copy the source GPO if a GPO with the specified (target) display name already exists in the destination domain. In this case, an error occurs and the
GPO is not copied.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/?linkid=287713
Get-GPO
Import-GPO
New-GPO
Restore-GPO

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

C:\PS>Copy-GPO -SourceName TestGpo1 -TargetName TestGpo2

DisplayName : TestGpo2

DomainName : contoso.com

Owner : CONTOSO\Domain

Admins Id : 37eeb072-cc31-42bb-8c3a-446c2b6ddd3f

GpoStatus : AllSettingsEnabled

Description :

CreationTime : 2/25/2009 9:12:05 PM

ModificationTime : 2/25/2009 9:12:05 PM

UserVersion : AD Version: 1, SysVol Version: 1

ComputerVersion : AD Version: 1, SysVol Version: 1

WmiFilter :



Description

-----------

This command copies the "TestGpo1" GPO to a GPO named "TestGpo2". The GPOs exist in the domain of the user that is running the session (or, for startup and shutdown scripts,
the computer).




-------------------------- EXAMPLE 2 --------------------------

C:\PS>Copy-GPO -SourceName TestGpo1 -SourceDomain test.contoso.com TargetName TestGpo1 -TargetDomain sales.contoso.com



Description

-----------

This command copies the "TestGpo1" GPO from the test.contoso.com domain to a GPO named TestGpo1 in the sales.contoso.com domain.

A trust relationship must exist between the source domain and the destination domain. In addition, if the source domain or the destination domain (or both) is different than
the domain of the user that is running the session (or, for startup and shutdown scripts, the computer), a trust must exist between that domain and the domain of the user
(or the computer).




-------------------------- EXAMPLE 3 --------------------------

C:\PS>get-gpo -all -domain sales1.contoso.com | foreach-object {$_ | copy-gpo -targetName ($_.DisplayName) -targetdomain sales2.contoso.com -copyacl -migrationtable
c:\tables\MigrationTable.migtable}



Description

-----------

This command copies all the GPOs in the sales1.contoso.com domain to the sales2.contoso.com domain.

First, all the GPOs in the source domain are retrieved by using the Get-GPO cmdlet with the All parameter. The output of Get-GPO is piped into the foreach-object command.
When each GPO is evaluated, it is piped into Copy-GPO and its display name is specified for the TargetName parameter "-targetName ($_.DisplayName)". The CopyACL parameter is
specified to copy the ACLs for each GPO to the destination domain. The MigrationTable parameter specifies a migration table to use to migrate Security principals and UNC
paths to the destination domain. Both the CopyACL and the MigrationTable parameters are optional.

If a GPO with the same display name as a source GPO already exists in the destination domain, an error occurs when this command attempts to copy the source GPO. Because this
command copies all GPOs in the source domain, errors occur for default GPOs; for example, the "Default Domain Policy" GPO and the "Default Domain Controllers Policy" GPO.
These GPOs are not copied. You can suppress these error messages by supplying the ErrorAction parameter with a value of SilentlyContinue to Copy-GPO. For more information
about the ErrorAction parameter, see about_CommonParameters.

The (destination) GPOs that were successfully copied are returned by this command. By default, they are printed to the display, but you can add commands to the end of the
pipeline to further configure these GPOs. For example you can add a Set-GPLinks cmdlet to the end of the pipeline to link all the destination GPOs to a site, domain, or
organizational unit.

A trust relationship must exist between the source domain and the destination domain. In addition, if the source domain or the destination domain (or both) is different than
the domain of the user that is running the session (or, for startup and shutdown scripts, the computer), a trust must exist between that domain and the domain of the user
(or the computer).