remove local admins
1 TopicRemove list of users from Local Administrators group on list of computers
Hello, we are trying to remove users from the local administrators group on a bunch of computers. After that we will implement a GPO to control who is added to the local admin group on all computers. What I am looking for is a script to remove multiple users from the local admin group a list of multiple computers. The code below does not seem to be working correctly. Can anyone help with what I am doing wrong? $users = get-content .\users.txt $computers = get-content .\computers.txt foreach ($computer in $computers){ invoke-command -computername $computer -scriptblock {Get-LocalGroupMember -Group 'Administrators' | where {$_.objectclass -like $users} | Remove-LocalGroupmember Administrators} }Solved7KViews0likes3Comments