When we rolled out our last group of PC's, we made all of the users Local Administrators of their own PC. We would like to reverse this policy and remove the users as local administrators. Is there a way to script this to run through my K1000 so that we do not have to physically go to each machine and manually remove the users?

Thank You,


0 Comments   [ - ] Hide Comments


Please log in to comment

Answer this question or Comment on this question for clarity


Use Group Policy to control membership of built-in groups.
Answered 06/26/2014 by: VBScab
Red Belt

Please log in to comment
The command to remove a user or group from a localgroup is:
net localgroup administrators domain\group /delete

You should be able to run this as either a KScript or a shell script. I have done this to add users and groups with a KACE script without any issues.

Answered 06/26/2014 by: chucksteel
Red Belt

Please log in to comment
If you have an uinque user on each machine and do not have too many off them you can use the command chuck mentioned in a batch file with all those users.  The lines that do not apply just error and move to the next line.  You would want to run this invisible because the errors will go by in the command window if you do not hide it.  This way you can create one script for the group of machines, else you will need to create a script for each user/machine.


Sample batch file

net localgroup administrators domain\group /delete
net localgroup administrators domain\user1 /delete
net localgroup administrators domain\user2 /delete
net localgroup administrators domain\user3 /delete
net localgroup administrators domain\user4 /delete
net localgroup administrators domain\user5 /delete
net localgroup administrators domain\user6 /delete
net localgroup administrators domain\user7 /delete
net localgroup administrators domain\user8 /delete
net localgroup administrators domain\user9 /delete

Answered 06/26/2014 by: SMal.tmcc
Red Belt

Please log in to comment
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja