Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

delete user from local administrator account

2 views
Skip to first unread message

buteau

unread,
Nov 7, 2008, 5:01:01 PM11/7/08
to
Hi all,

i am trying to use this script to delete a user named test1 from the local
administrator group. Each time i run it, it came up with errors. Any help to
get thid script running will be greatly appreciated
thanks


below is the script


Option Explicit

Dim src, username
src = "delete.txt"
username = "test1"

cleanAdminGroup src, username

Function cleanAdminGroup(file,username)
Dim network, group, user, fso, temp, ts
Set network = CreateObject("WScript.Network")
Set fso = CreateObject("Scripting.FileSystemObject")

If Not fso.FileExists(file) Then
WScript.Echo "File does not exist: " & file
Else
Set ts = fso.OpenTextFile(file,1)
Do Until ts.AtEndOfStream
temp = ts.ReadLine
Set group = GetObject("WinNT://" & temp & "/Administrators,group")
For Each user In group.members
If UCase(user.name) = UCase(username) Then
group.remove user.adspath
End If
Next
Loop
group.add("WinNT://("ou=laptop,ou=BUTEAU,ou=ADMIN_TEST,dc=tch,dc=edu")
>>move2bccr.log
End If
End Function

0 new messages