'author richard moyle
'On Error Resume Next
SetLocale("en-us"
Dim FSO, WshShell, refWMIService, refDirectory
Dim strDir
'default objects
Set FSO = WScript.CreateObject("Scripting.FileSystemObject"

Set WshShell = WScript.CreateObject("WScript.Shell"

Set dicResults = Wscript.CreateObject("Scripting.Dictionary"

'use wmi to get all files with the uls* name
strDir = "f:\"
Set objDir = FSO.GetFolder(strDir)
getInfo(objDir)
'write results to a logfile
Set tsResults = FSO.CreateTextFile("c:\auditresults.log", True)
For Each aKey In dicResults
tsResults.WriteLine aKey & "=" & dicResults.Item(aKey)
Next
tsResults.Close
Set tsResults = Nothing
'end of script part
Function getInfo(pCurrentDir)
For Each aItem In pCurrentDir.Files
'wscript.Echo aItem.Name
If LCase(Left(Cstr(aItem.Name), 3)) = "uls" Then
checkFile(aItem)
End If
Next
For Each aItem In pCurrentDir.SubFolders
'wscript.Echo aItem.Name & " passing recursively"
getInfo(aItem)
Next
End Function
'check the file contents for what we are looking for!!!
Function checkFile(pFile)
On Error Resume Next
Dim strUser, tsLog, sLine, lPos, strMapping
Wscript.Echo pFile.Path & " from here"
Set tsLog = FSO.OpenTextFile(CStr(pFile.Path), 1, False)
Do While Not tsLog.AtEndOfStream
sLine = Trim(LCase(tsLog.ReadLine))
If InStr(sLine, "over 3 patterns old"

Then
msgbox "over3;" & pFile.Name
'dicResults.Add pFile.Name, "1"
End If
If InStr(sLine, "unable to determine current pattern"

Then
msgbox "none;" & pFile.Name
'dicResults.Add pFile.Name, "1"
End If
Loop
tsLog.Close
Set tsLog = Nothing
End Function