Remove all member of a OU from all Groups

Welcome Forums General PowerShell Q&A Remove all member of a OU from all Groups

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

  • Author
    Posts
  • #5873

    Member
    Points: 0
    Rank: Member

    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

The topic ‘Remove all member of a OU from all Groups’ is closed to new replies.