Set fileItems = objSWbemServices.ExecQuery("Select * FROM CIM_DataFile
WHERE Drive = 'C:' AND Path = '\\the path\\xxx\\xxxx\\' AND Extension =
'INI'")
If Err.number <> 0 Then
wscript.echo "Problem with DataFile set"
End If
for each objItem in fileItems
'Get version
strFileName = "the File I want"
If objItem.FileName = strFileName Then
strFileName = "C:\\path\xxxx\xxxx\" &strFileName &".ini"
wscript.echo "File Name to be opened : " &strFileName
Set objTextFile = objFSO.OpenTextFile(strFileName, ForReading)
If Err.number <> 0 Then
wscript.echo "Problem opening the file"
End If
Do Until ObjTextFile.AtEndOfStream
strNextLine = objTextFile.ReadLine
intLineFinder = InStr(strNextLine, "Installed Version=")
If intLineFinder <> 0 Then
strVersion = Mid(strNextLine, 19, 10)
objExcel.Cells(intRow,7).Value= strVersion
End If
Loop
End If
This lists all the files on the remote machine if I want it to, but will not
open the file. Is this at all possible?
If you can list the files on the remote machine - and provided the
remote user who executes the files has read and execute file permissions
on the remote host - you should in fact be able to open and read the
file content.
--
Best regards,
Thomas Moeller Nexoe
--------------------------------------
Website: http://www.winfrastructure.dk
Blog: http://www.winfrastructure.net