Monday, February 7, 2011

Remove From Local Administrators VBS Script

Script will remove the users from Local Administrators group except which are stated in script.Username must be in CAPITAL letter.

Script

Option Explicit
Dim network, group, user
Set network = CreateObject("WScript.Network")
Set group = GetObject("WinNT://" & network.ComputerName & "/Administrators,group")
For Each user In group.members
If UCase(user.name) <> "user1" And UCase(user.name) <> "user2" And UCase(user.name) <> "user3" And UCase(user.name) <> "user4" And UCase(user.name) <> "user5" And UCase(user.name) <> "user6" Then
group.remove user.adspath
End If
Next

No comments:

Post a Comment

 
span.fullpost {display:inline;}