I have a script that searches remote computers for PST files via WMI. The problem that I have is that on certain computers it errors, but the error is displayed on the remote computer and the script hangs until someone clicks "OK". Not a big deal, but this script pulls every computer from AD and runs against each one. We'd like to be able to schedule this script to run on the weekends on a regular basis without anyone around to baby sit it. Any suggestions as to how to suppress the error on the remote machine? I'll include the pertinent code for the problem.
Code:
On Error Resume Next
strComputer = "Remote-PC"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
("Select * from CIM_DataFile Where Extension = 'pst'")
For Each objFile in colFiles
Wscript.Echo objFile.Drive & objFile.Path
Wscript.Echo objFile.FileName & "." & objFile.Extension
Wscript.Echo objFile.FileSize
Wscript.Echo
Next