this is what I have right now need help calling a specific group(guest group)
and delete the tsinternetuser account out of that group using a list of
servers I need this done one.

strFilePath = "c:\test.txt"
errorlog = "c:\error.txt"

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objtextFile = objFSO.OpenTextFile (strFilePath)
Set objFile = objFSO.CreateTextFile(errorlog, True)

On Error Resume Next ' moved this out of the Do loop

Do Until objtextFile.AtEndOfStream

strComputer = Trim(objtextFile.ReadLine)
if len(strComputer) <> 0 then

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery _
("Select * from Win32_TSAccount Where AccountName =
'strcomputer\tsinternetuser'")

For Each objItem in colItems
errResult = objItem.Delete()
Next

end if

loop


objFile.Close
objTextFile.close
result = objfso.OpenTextFile(errorlog, 1).ReadAll
wscript.echo result



("Select * from Win32_TSAccount Where AccountName = '" & strcomputer &
"\tsinternetuser'")

RE: delete tsinternet user from guest group on server using server lis by RunningWolf

RunningWolf
Thu Sep 22 19:57:01 CDT 2005

I found this article that might be helpful. It provide a method with only
four lines of code.

http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/usersgroups/localgroups/

"chpst" wrote:

> this is what I have right now need help calling a specific group(guest group)
> and delete the tsinternetuser account out of that group using a list of
> servers I need this done one.
>
> strFilePath = "c:\test.txt"
> errorlog = "c:\error.txt"
>
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Set objtextFile = objFSO.OpenTextFile (strFilePath)
> Set objFile = objFSO.CreateTextFile(errorlog, True)
>
> On Error Resume Next ' moved this out of the Do loop
>
> Do Until objtextFile.AtEndOfStream
>
> strComputer = Trim(objtextFile.ReadLine)
> if len(strComputer) <> 0 then
>
> Set objWMIService = GetObject("winmgmts:" _
> & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
>
> Set colItems = objWMIService.ExecQuery _
> ("Select * from Win32_TSAccount Where AccountName =
> 'strcomputer\tsinternetuser'")
>
> For Each objItem in colItems
> errResult = objItem.Delete()
> Next
>
> end if
>
> loop
>
>
> objFile.Close
> objTextFile.close
> result = objfso.OpenTextFile(errorlog, 1).ReadAll
> wscript.echo result
>
>
>
> ("Select * from Win32_TSAccount Where AccountName = '" & strcomputer &
> "\tsinternetuser'")
>