as title says, I have to find all the groups that the user is a member of, and deleting its membership from all of them.
I've tried this:
get-adgroup -filter * | where {(Get-ADGroupMember $_ | foreach {$_.PrimarySmtpAdress}) -contains "
[email protected]"}
but it
doesnt return anything (although THERE ARE some items that have to be returned)
as for the deletion I found no way to do it, could someone give me an example of a code that does this?
Im talking about security groups.