Заметки сисадмина » Remove all users from local admin group except specified users

Заметки сисадмина о интересных вещах из мира IT, инструкции и рецензии. Настраиваем Компьютеры/Сервера/1С/SIP-телефонию в Москве

Remove all users from local admin group except specified users

2023-09-28 · Posted in PowerShell

I am looking at running a script on all computers to remove all local administrators except

the ones we specify it will only be a few.  We are trying to make sure no users have local admin access.
We have to send this out to probably 1500 computers  but the same accounts can stay in all of them, but only those accounts
example
administrator
admin1
admin2
admin3

This script removed all but the administrator I need to add more exclusions

This startup script leaves in administrators – the listed accounts, the rest are moved to the Users group. Instead of “domain” you need to substitute netbios name of your domain.

Leave a Reply