0 votes

Is it possible using PowerShell to copy group memberships from an already existing user without copying 2 specific groups named for example test and test 1 ?

We are currently already using a PowerShell script to copy the group memberships, so only the part that needs to be added in which 2 certain groups are not included.

I can share the PowerShell script if needed.

KR, Cas

by (200 points)

1 Answer

0 votes
by (287k points)
selected by
Best answer

Hello Cas,

Have a look at the scripts from the following article in our repository: https://www.adaxes.com/script-repository/copy-group-membership-from-specified-user-s590.htm.

0

Thanks for your quick reply!

Is it also possible to do this based on, for example, the first 4 characters of the groupname, where the rest of the name is variable?

Example:

SEC-"variable" or APP-"Variable". So that it skips everything with "SEC" or "APP" in the groupname ?

0

Hello Cas,

The functionality is already present in the first script from the article we referenced. In your case, you need to set the $groupNamesToSkip variable as follows:

$groupNamesToSkip = @("SEC*", "APP*") # TODO: modify me
0

Thanks for your answer. I have it working now!

KR, Cas

Related questions

0 votes
1 answer

Our Help Desk currently 'mirrors' the group membership of a new user based on another existing user in our AD. I'd like to be able to automate this so that the initiator ... and 'paste' it on the new user being created. Any help on this would be appreciated!

asked Apr 21, 2020 by RayBilyk (240 points)
0 votes
1 answer

Hi, Group memberships are kept when using "User Copy" function. Is it possible to do the same thing between two existing users ? (custom commands or else) Thanks for your response, Yoann

asked Oct 4, 2012 by yoann.hamon (180 points)
0 votes
1 answer

How can I create a script that does these things For internal audit. objective Even removing all groups of a disconnected user, we will still know which groups the ... in the created group (audit)-sAMAccountName-access add the (user)-sAMAccountName in members

asked Jul 2, 2022 by alancardoso (40 points)
0 votes
1 answer

I've looked at https://www.adaxes.com/script-repository/copy-group-membership-from-specified-user-s590.htm. is there away to change from group names to a group type? Like exclude all distribution groups?

asked Dec 4, 2023 by Derek.Axe (480 points)
0 votes
1 answer

Hello Back when we first started using Adaxes you created a couple of great scripts which worked together really well, the first one copied one users group membership and put in ... an addition to what groups the second user is already a member of? Thank you.

asked Aug 4, 2015 by CBurn (700 points)
3,526 questions
3,217 answers
8,197 comments
547,625 users