Question

I obtained this script from another site, and attempted to modify it to search more than two drives, specifically I wanted it to search almost every drive possible, but as soon as i add a third drive letter the script does not work.

 strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colFiles = objWMIService.ExecQuery _
    ("Select * from CIM_DataFile Where Extension = 'mdb' AND (Drive = 'B:' OR Drive = 'C:' OR Drive = 'D:')")

' If colFiles.Count = 0 Then
'     Wscript.Quit
' End If

Set objTextFile = wshfso.CreateTextFile("c:\temp\" & vComputer & ".txt " , True)

For Each objFile in colFiles
    objTextFile.Write(objFile.Drive & objFile.Path & "")
    objTextFile.Write(objFile.FileName & "." & objFile.Extension & ", Size ")
    objTextFile.Write(objFile.FileSize /1024 & "kb" & vbCrLf)
Next

No correct solution

OTHER TIPS

You've got 2 variables, "vComputer" and "strComputer".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top