Ying Li at myITforum.com

PowerShell & System Center

VB Script to check size and modified date for a list of files

Here is a VB script to check file size and modified date aginist a list of files on a list of servers.

On Error Resume Next

Set oFSO = CreateObject("Scripting.FileSystemObject")

Set InputFileX = oFSO.OpenTextFile("C:\Temp\MachineList.Txt")
Do While Not (InputFileX.atEndOfStream)
strComputer = InputFileX.ReadLine

Wscript.Echo strComputer

CheckFile

Loop

'************************************************************************************************
Function CheckFile

Set InputFileY = oFSO.OpenTextFile("C:\Temp\FileList.Txt")
Do While Not (InputFileY.atEndOfStream)
FileName = InputFileY.ReadLine

Wscript.Echo FileName

Set TargetFile = OFSO.GetFile(Filename)

Modifieddate = TargetFile.DateLastModified
Wscript.Echo Modifieddate

FileSize = TargetFile.Size
Wscript.Echo FileSize & " Bytes"

Loop

End Function

Posted: Nov 15 2007, 09:53 PM by yli628 | with 1 comment(s)
Filed under:

Comments

Ying Li at myITforum.com said:

This is a VB Script and it is a “make over” of my previous post http://myitforum.com/cs2

# December 6, 2007 7:54 PM