Sunday, 9 May 2021

How to remove all group member from the group Using PowerShell

 How to remove all group member from the group member

Using PowerShell


For the Singal group use this command

 

Get-ADGroupMember -Identity tri | Remove-ADPrincipalGroupMembership -MemberOf tri -Confirm:$false

  

For the Multiple Group use this Command

 

$Groups = Get-Content C:\Users\Administrator\Desktop\Groups.txt

foreach ($Group in $Groups){

Get-ADGroupMember -Identity $Group | Remove-ADPrincipalGroupMembership -MemberOf $Group -Confirm:$false

No comments:

Post a Comment