< Back

Set-ADUserExistingGroupMembership

Mon Jan 13, 2020 5:19 am

NAME Set-ADUserExistingGroupMembership



SYNOPSIS

Update Existing AD User Group Membership





SYNTAX

Set-ADUserExistingGroupMembership [-UsernameToCopyGroupMembershipFrom] <String> [-UsernameToCopyGroupMembershipTo]

<String[]> [-WhatIf] [-Confirm] [<CommonParameters>]





DESCRIPTION

This Cmdlet copies AD User group Membership from an existing AD User and applies it to another existing AD User.





PARAMETERS

-UsernameToCopyGroupMembershipFrom <String>



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-UsernameToCopyGroupMembershipTo <String[]>



Required? true

Position? 2

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Confirm [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





This Cmdlet will copy all groups from exsisting (UsernameToCopyGroupInfoFrom) to and existing user

(UsernameToCopyGroupInfoTo).

the cmdlet requires the ActiveDirectory module and will attempt to import it.



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



PS C:\\>Get-PETADUserGroupInfo -UsernameToCopyGroupMembershipFrom TestUSer01 -UsernameToCopyGroupMembershipTo

TestUser02 -verbose













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



PS C:\\>Import-CSV C:\\Scripts\\AdUserInfo.csv | Get-PETADUserGroupMembership -verbose















RELATED LINKS