Hi,
Suppose the CSV file has columns with the headers "ComputerName", "Group" and "Member".
ComputerName,Group,Member
win2k8R2,administrators,abc
win2k12R2,Administrators,xyz
You can try something like below
$file = 'C:\temp\members.csv'
Import-Csv -Path $file | ForEach-Object {
Invoke-Command -ComputerName $_.ComputerName -ScriptBlock{
Remove-LocalGroupMember -Group $using:_.Group -Member $using:_.Member
}
}
Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.