Hey all,
I am currently working on a script to help combat a virus that's been hiding around our network. We've isolated the folders it creates and have a .bat file (created by my boss) that can be used to clean the computer (stop the processes, deal with permission issues, delete the files). I have then created a vbscript to detect if these folders exist when a user logs on and, if so, send an e-mail to me.

I am currently working on a script to take a text file with a list of the computer names, check if they're on, if so check for each virus folder and, if one is found, run the corresponding batch file to clean it. The problem I'm currently having is a For Each loop that the script won't seem to enter (line 46). As can be seen in the code, I call a MsgBox before the loop and this pops up fine. But then I try to call up a MsgBox immediately upon entering the loop and get nothing. Any insight would be greatly appreciated. Thanks in advance.

~Wiggz

Code:
Dim fso
Dim filename
Dim parentFolder
Dim arrFileLines(), badFiles()
Const ForReading = 1

'Create file system object
set fso = CreateObject("Scripting.FileSystemObject")
'Read InfectedComps for a list of the computers to check
Set objFile = fso.OpenTextFile("Q:\Scripts\InfectedComps.txt", ForReading)
'Create a new text file to write a report to
Set report = fso.CreateTextFile("Q:\Scripts\CleaningReport.txt")
report.WriteLine "Cleaning Report for " & date
'Shell to run the .bat files
Set WSHShell = WScript.CreateObject("WScript.Shell")
On Error Resume Next

'Read the lines of the InfectedComps and store
i = 0
Do Until objFile.AtEndOfStream
	Redim Preserve arrFileLines(i)
	arrFileLines(i) = objFile.ReadLine
	i = i + 1
Loop
objFile.Close

'Names found on computers that indicate a virus
badfiles(1) = "ifqueoq"
badfiles(2) = "fcevhoo"
badfiles(3) = "ofjaiec"
badfiles(4) = "veaib0xa"

For Each computerName in arrFileLines
	report.write computerName & " - "
	
	'Ping the computer to make sure it exists/is on
	Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._  
		ExecQuery("select Replysize from Win32_PingStatus where address = '" & computerName & "'")  
  
	For Each objStatus in objPing  
		'If the ping is successful...
		If Not IsNull(objStatus.ReplySize) Then  
			report.writeline "Contacted"
			parentFolder = "\\" & computerName & "\c$\Documents and Settings\All Users\Application Data\Microsoft\"
			MsgBox parentFolder 'For testing - this box does pop up
			For Each virus in badfiles '<- problem
				MsgBox parentFolder & virus & "\" 'For testing - this box does NOT pop up 
				If fso.FolderExists(parentFolder & virus & "\") Then
					report.WriteLine virus & " found.  Cleaning..."
					WSHShell.run virus & "-purge.bat " & computerName,1,True
					If fso.FolderExists(parentFolder & virus & "\") Then
						report.WriteLine virus & " cleaning failed"
					Else
						report.WriteLine virus & " cleaned"
					End If
				End If
			Next
		Else
			report.WriteLine "Not Found"
		End If  
	Next  
  
	Set objPing=Nothing
	Set objStatus=Nothing
Next
report.close
MsgBox "Done"
set fso = nothing