E
E
EddyStarky232021-10-14 16:45:48
Active Directory
EddyStarky23, 2021-10-14 16:45:48

How to remove one group from a user group in AD?

Hello.
I can’t figure out how to build a team in the paver. Or is there another way?

There is a container in AD with users, you need to delete one group from everyone. That's the whole dilemma, I don't want to do it manually =)
If the command is to build, then what is the right way to specify the container with users and the command to delete the group by its name

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Dmitriev, 2021-10-14
@SignFinder

1. Form a list of users from the OU via Get-ADUser -Filter * -SearchBase, drive the field you need - SamAccountName or Distunguished Name - into a variable.
2. Through ForEach, you pass each value from the variable to the Remove-ADGroupMember command.
It is quite possible that there are options without a cycle and even simpler.
Help with examples for each command is here https://docs.microsoft.com/en-us/powershell/module...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question