-1

Active Directory via powershell want to add users to a specific group. But that is a member of a particular group of users that other members do not want to be included in the relevant group.

For example, a member of the ABC member Group1. Therefore, these members do not want to add to Group2.

As a second example, the ABC member is not a member of Group1. I want to add this member to a member of Group2.

On these variables using Powershell was not able to fully do not know. I would appreciate if you could help.

1 Answer 1

0

You could try querying the ad groups using powershell, then adding the user to group2 if he isn't a member of group1.

$testMember = Get-AdGroupMember Group1 | WHERE{$_.SAMAccountName -ilike 'ABC'}
if (!$testMeber){ Add-Agroupmember -ideneity Group2 -Members ABC}

Add-AdGroupmember, Get-ADGroupmember

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .