Skip to main content
Set User And Group Mapping
Updated this week

Command

Set-UserAndGroupMapping

Description

The command to add or update a user or group mapping in the mapping settings.

Index

Examples

Set custom mappings

$mappingSettings = Set-UserAndGroupMapping -Source "John Doe" -Destination "Paul Smith"
$mappingSettings = Set-UserAndGroupMapping -MappingSettings $mappingSettings -Source "myusername" -Destination "anotherusername"
$mappingSettings = Set-UserAndGroupMapping -MappingSettings $mappingSettings -UnresolvedUserOrGroup -Destination "Old employee Group"
$mappingSettings
PropertyMappings        :
ContentTypeMappings     :
UserAndGroupMappings    :  <Unresolved users or groups> -> Old employee Group
                           John Doe                     -> Paul Smith
                           myusername                   -> anotherusername
PermissionLevelMappings :
SiteTemplateMappings    :

Set custom mappings on existing mappings from a source list and a destination list

$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
$mappingSettings = Get-UserAndGroupMapping -SourceSite $srcSite -DestinationSite $dstSite
$mappingSettings = Set-UserAndGroupMapping -MappingSettings $mappingSettings -Source "John Doe" -Destination "Paul Smith"
$mappingSettings = Set-UserAndGroupMapping -MappingSettings $mappingSettings -Source "myusername" -Destination "anotherusername"
$mappingSettings = Set-UserAndGroupMapping -MappingSettings $mappingSettings -UnresolvedUserOrGroup -Destination "Old employee Group"
$mappingSettings
PropertyMappings        :
ContentTypeMappings     :
UserAndGroupMappings    :  <Unresolved users or groups> -> Old employee Group
                           CustomPermissions Members    -> Sales&Marketing Owners
                           i:0#.w|office\sg.achille     -> i:0#.w|office\sg.baptiste
                           i:0#.w|office\sg.camille     -> i:0#.w|office\sg.denis
                           John Doe                     -> Paul Smith
                           myusername                   -> anotherusername
PermissionLevelMappings :
SiteTemplateMappings    :

Syntax

Set-UserAndGroupMapping-Source <String>
-Destination <String>
[-MappingSettings] <MappingSettings>
Set-UserAndGroupMapping-Source <String>
-Ignore <SwitchParameter>
[-MappingSettings] <MappingSettings>
Set-UserAndGroupMappingUnresolvedUserOrGroup <SwitchParameter>
-Destination <String> 
[-MappingSettings <MappingSettings>]

Parameters

-Destination <String>

Specifies the destination user or group.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

Default, Unresolved

Aliases

None

-Ignore <SwitchParameter>

Specifies to ignore the user or group.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

ExplicitIgnore

Aliases

None

-MappingSettings <MappingSettings>

Specifies the mapping settings.

Required?

False

Default value

None

Accept pipeline input?

True (ByValue, ByPropertyName)

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-Source <String>

Specifies the source user or group.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

Default, ExplicitIgnore

Aliases

None

-UnresolvedUserOrGroup <SwitchParameter>

Specifies to use unresolved users or groups for the source.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

Unresolved

Aliases

None

Did this answer your question?