I would like to add a piece of code to SYDI that would return me the location & size of a specific file.
For example, a server "X" has a DB file(s) & path like this: "C:\XYZ\Database\randomfilename.ext" and which is lets say 45 GB.
The location,name and of course the size of the file different among many servers. I would like it to return the location of the file (that has the extension of ".ext",which probably is unique at least in those servers): such as C:\XYZ\Database\ and the size.
It would be very helpful if you could point me in the right direction.
This is what I've tried so far, returning nothing even if there is an .ext file.
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
("Select * from CIM_DataFile Where Extension = 'ext'")
For Each objFile in colFiles
Wscript.Echo objFile.Drive & objFile.Path
Wscript.Echo objFile.FileName & "." & objFile.Extension
Wscript.Echo objFile.FileSize
Wscript.Echo
Next
Thanks