If you plan on running the script LOCALLY then this should work (assuming you're looking to clean up the local Administrators group):
$GroupName = "Administrators"
$GoodList = \\ShareName\GoodList.txt
$GoodAdmins = Get-Content $Goodlist
Get-LocalGroupMember $GroupName |
ForEach-Object{
if ($_.ObjectClass -eq 'User'){
if ($GoodAdmins -contains $_.Name){ # ignore groups in the administrators group
}
else{
Remove-LocalGroupMember -Group $GroupName -Member $_.Name -WHATIF
}
}
}
Remove the "-WHATIF" when you're satisfied the script isn't removing something it shouldn't be!
If you're going to be doing this on remote machines you can make the script into a script block and use Invoke-Command.
EDIT: Removed the "Continue" -- that only works when it's not working with pipelined data.