Tuesday, 11 May 2021

How to remove multiples users from multiples group using PowerShell

How to remove multiples users from multiples group using PowerShell

 

File Format






Import-Csv "C:\Users\Administrator\Desktop\bulkuserandgroup.csv" | Group-Object Group | % {

       $users = $_.Group | % { Get-ADUser $_.Accountname }

      Remove-adgroupmember -identity $_.Name -members $users -Confirm:$false

 }


1 comment: