Remove all member of a OU from all Groups

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 5 years, 11 months ago.

  • Author
    Posts
  • #5873

    by pumabaer at 2013-05-01 00:12:37

    Is there nobody here who can help me to solve my Question ?

    Q: I wan´t to remove all Members of a OU from all Groups they are Member of, I tried this:

    $User = Get-ADUser -Filter * -Searchbase "OU=test,OU=testtest,OU=test,DC=test,DC=test"
    Get-ADPrincipalGroupMembership $User| % {Remove-ADPrincipalGroupMembership $User -Confirm:0 -MemberOf $_}

    and some other things.
    Can anybody help me to find out what is wrong.

    Thanks so much Stefan

You must be logged in to reply to this topic.