Is there a way through command line to remvoe all the users in a security group (from Local Users and Groups)?
I can remove a single user with "net localgroup", but I don't know who is in the group.
Is there a way through command line to remvoe all the users in a security group (from Local Users and Groups)?
I can remove a single user with "net localgroup", but I don't know who is in the group.
A script would be a better solution but here is the command. (Don't forget to change groupname)
for /F "skip=6" %i in ('net localgroup groupname') do net localgroup groupname %i /delete
If you take a look at 'net localgroup groupname' structure you will see why I skip 6 tokens and that it produces an error at the end, because the last token is the confirmation that the command was successfully executed. As far as I know you need to write a script to get rid of that.