quarta-feira, 27 de julho de 2011

Remove All users from Local Administrator Group

Hi !

Today, I've needed to find a way to remove all users from local administrator group trough GPO tools. I've found a perfect script wich complete this task . Here is bellow:

Dim network, group, user
Set network = CreateObject("WScript.Network")
Set group = GetObject("WinNT://" & network.ComputerName & "/Administradores,group")
For Each user In group.members
If UCase(user.name) <> "ADMINISTRADOR" And UCase(user.name) <> "DOMAIN ADMINS" Then
group.remove user.adspath
End If
Next


Before to use it, you need to do a little change in these lines

Set group = GetObject("WinNT://" & network.ComputerName & "/Administradores,group")
For Each user In group.members
If UCase(user.name) <> "ADMINISTRADOR" And UCase(user.name) <> "DOMAIN ADMINS" Then

Nenhum comentário:

Postar um comentário