I was wondering if anyone could help me create a VBScript the with
check a list of remote computers to see if a folder exist and input
that information in a text file it does or not

RE: VBScript That Checks To See If Folder Exists (Loop Of Computers) by urkec

urkec
Sun Dec 17 06:03:01 CST 2006

Set fso = CreateObject ("Scripting.FileSystemObject")
Set computerList = fso.OpenTextFile ("C:\Scripts\computerList.txt", 1)
Set outputList = fso.OpenTextFile ("C:\Scripts\outputList.txt", 2, True)
strFolder = "'c:\\TestFolder'" 'folder to test

Do While Not computerList.AtEndOfStream

On Error Resume Next

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

If Err.number <> 0 Then
outputList.WriteLine strComputer & vbTab & _
"The remote server machine does not exist or is unavailable"
Else
Set colFolders = objWMIService.ExecQuery _
("Select * from Win32_Directory where Name = " & strFolder)
If colFolders.Count > 0 Then
outputList.WriteLine strComputer & vbTab & "Folder Exists"
Else
outputList.WriteLine strComputer & vbTab & "Folder does not exist"
End If
End If

Loop


'Hope this helps you
--
urkec