Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 688

Modify check if file exists script to include DateCreated property

$
0
0
Hey guys -- I have a script that currently checks a number of systems across based on a list of workstations (strFile) on the network for a file's existence (strTarget):

Code:

Option Explicit
Dim objFSO, strFile, objTextFile, strComputer, strTarget
Const ForReading = 1

strFile = "c:\scripts\servers.txt"

strTarget = "c$\Temp\app.exe"

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(strFile, ForReading)

Do Until objTextFile.AtEndOfStream
  strComputer = objTextFile.ReadLine
  ' Skip blank lines.
  If (strComputer <> "") Then
    If (objFSO.FileExists("\\" & strComputer & "\" & strTarget) = True) Then
      Wscript.Echo "exists " & strComputer
    Else
      Wscript.Echo "not exist " & strComputer
    End If
  End If
Loop

objTextFile.Close

I'd like to modify this to include, in the output, the file's DateCreated property (and/or multiple properties, such as the File's LastModifiedDate and 'Owner', though I've read/understand that the 'Owner' property is a feat unto itself).

My VBS skills aren't at all what I'd like them to be -- I can usually read, understand and modify basic scripts, but I'm having a problem with getting this to do anything other than what it's doing...

Anyone able to provide some assistance?

Thanks in advance...

Viewing all articles
Browse latest Browse all 688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>