Skip to main content
Copy Group
Updated this week

Command

Copy-Group

Description

The command to copy groups from a SharePoint site to another.

Note: This command only applies to SharePoint groups. It does not apply to Microsoft 365 Groups.

Index

Examples

Get Groups to Copy

$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
$toCopy = Get-Group -Site $srcSite
Copy-Group -Group $toCopy -DestinationSite $dstSite

Copy All Groups

$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
Copy-Group -All -SourceSite $srcSite -DestinationSite $dstSite

Copy Some Groups

$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
Copy-Group -Name MyName*,MySpecificName -SourceSite $srcSite -DestinationSite $dstSite

Note: The * symbol is used to call multiple objects with a similar name.

Copy All Groups Pre-Check

$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
Copy-Group -All -SourceSite $srcSite -DestinationSite $dstSite -WhatIf

Syntax

Copy-Group-Group <Group[]>-DestinationSite <Site>[-WhatIf <SwitchParameter>][-CopySettings <CopySettings>][-MappingSettings <MappingSettings>][-TaskName <String>]
Copy-Group-Name <String[]>-SourceSite <Site>-DestinationSite <Site>[-WhatIf <SwitchParameter>][-CopySettings <CopySettings>][-MappingSettings <MappingSettings>][-TaskName <String>]
Copy-Group-All <SwitchParameter>-SourceSite <Site>-DestinationSite <Site>[-WhatIf <SwitchParameter>][-CopySettings <CopySettings>][-MappingSettings <MappingSettings>][-TaskName <String>]

Parameters

-All <SwitchParameter>

Specifies that they all be copied.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

All

Aliases

None

-CopySettings <CopySettings>

Specifies the copy settings.

Required?

False

Default value

None

Accept pipeline input?

True (ByValue, ByPropertyName)

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-DestinationSite <Site>

Specifies the destination site.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-Group <Group[]>

Specifies the source groups to copy.

Required?

True

Default value

None

Accept pipeline input?

True (ByValue, ByPropertyName)

Accept wildcard characters?

False

Parameter set name

Default

Aliases

None

-MappingSettings <MappingSettings>

Specifies the mapping settings.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-Name <String[]>

Specifies the name (Wildcards supported).

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

True

Parameter set name

Name

Aliases

None

-SourceSite <Site>

Specifies the source site.

Required?

True

Default value

None

Accept pipeline input?

True (ByValue, ByPropertyName)

Accept wildcard characters?

False

Parameter set name

Name, All

Aliases

None

-TaskName <String>

Specifies a name for the task.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-WhatIf <SwitchParameter>

Specifies that a pre-check will be executed instead of a migration. For more information, see Run a Pre-Check in PowerShell.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

Did this answer your question?