Just like we added AD users in a group with the help of Ad-ADGroupMember PowerShell cmdlet, we can also remove AD users from a group using PowerShell.

Remove AD Members from Group Using PowerShell

1. Open PowerShell with elevated privileges.

2. Execute the following cmdlet if you would like to remove a single or multiple users (in this case WilsonPais, administrator) suppose from DocumentReaders group.

Remove-ADGroupMember -Identity "DocumentReaders" -Member "WilsonPais","administrator"

3. Execute the following piped cmdlet if you would like to remove multiple users in an OU (suppose Students) from DocuementReader group.

Get-ADUser -SearchBase ‘OU=Students,DC=yourdomain,DC=com’ -Filter * | ForEach-Object {Remove-ADGroupMember -Identity ‘DocumentReaders’ -Members $_ -Confirm:$false }

References

How to Remove AD Members from Group Using PowerShell

One thought on “How to Remove AD Members from Group Using PowerShell

  • January 6, 2020 at 4:54 pm
    Permalink

    Hello, can you please help me with powershell script.
    Idea is I want to remove all users with -extensionAttribute3 “test” from specific group
    Can you help with this please.
    Thank you.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

*