I want to run the script from any computer and go to the path and search for
any pst.
strPath = "\\lmdatastore\data01\users\"
strUserName = "wperez"
strExtension = "pst"
Set objWMIService = GetObject("winmgmts:" _ <---- error in this block
& "{impersonationLevel=impersonate}!\\" _
& strPath & "\root\cimv2") ----> error in
this block
Set colItems = objWMIService. _
ExecQuery("Select * From Cim_DataFile " _
& "Where (Path = '" & strPath & "' & '" & strUserName & "' & And
Extension='" & strExtension & "'")
'
WScript.Echo "# of files found: " & colItems.Count
For Each objItem In colItems
Wscript.Echo "-----------------------------------"
Wscript.Echo "CIM_DataFile instance"
Wscript.Echo "-----------------------------------"
Wscript.Echo "FileName: " & objItem.Name
WScript.Echo "FileSize (bytes): " & objItem.FileSize
WScript.Echo strpath & strUserName
Next
I am getting an error:
(18, 1) (null): 0x80041021