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
Avatar

Karim Buzdar

About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn

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

  • Avatar
    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 *

*