Sunday, August 31, 2014

How to remove unnecessary users and groups from the local Administrators group, with a VBS script.

There are times when you want to restrict access to your computer at work. Disposable cleaning group will not help, because in the future membership of a group can change the domain group policy. Therefore, it may help a scheduled task, the task can be performed every 5 minutes. With "net localgroup" I was not able to remove the group from the group, so I propose to use the following VBS script to remove users and groups from the local Administrators group:

Download clear_adm.vbs

Set objGroup = GetObject("WinNT://./Administrators,group")

For Each Member in objGroup.members
 if not ((Member.name = "Administrator") or (Member.name = "myAccount1") or (Member.name = "myAccount2") or (Member.name = "myAccount3")) then objGroup.Remove(Member.ADSPath)
Next

No comments:

Post a Comment