Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare 2 files based on date-Install Patch 1

Status
Not open for further replies.

vb8304

IS-IT--Management
Mar 22, 2001
55
US
I need to install a patch on 450 plus computers for IE6. I will be comparing 2 files by their dates and based on that the script will determine if it needs to run the patch. The script has been done using Kix32 but it does not work. We currently use vbs but I am unceratin how to compare the 2 files based on their dates and if the installed file is older then the patch version install this patch.

Any ideas?
Thanks,
Vince.
 
Dim objFS
Dim objFolder
Dim objFiles
Dim objFile
set objfs = CreateObject("Scripting.FileSystemObject")
set objFolder = objfs.Gtfolder(strFolderName)
set objFiles = objFolder.Files
For Each objFile in objFiles
With objFile
.DateCreatd
.DatelastAccessed
.dateLastModified
Next Compare Code (Text)
Generate Sort in VB or VBScript
 
Here is the approach I took. Can you see any potential problems using this method?

sFileName1 = FileDateTime ("c:\windows\system\spoolss.dll") 'check file/date/time

sFileName2 = FileDateTime("x:\server\spoolss.dll") ' check file/date/time

If sFileName1 => sFileName2 Then
msgbox ("Your IE6 is Up to date")
Else
wshshell.run ("installation for patch goes here)
End If
 
"Returns a Variant (Date) that indicates the date and time when a file was created or last modified."

I don't trust it.
There is a new FSO method in VBScript 5.6. I have 5.1.

Try objFSO.GetFileVersion.
Download
Compare Code (Text)
Generate Sort in VB or VBScript
 
WHen using this methid
Dim objFS
Dim objFolder
Dim objFiles
Dim objFile
set objfs = CreateObject("Scripting.FileSystemObject")
set objFolder = objfs.Gtfolder(strFolderName)
set objFiles = objFolder.Files
For Each objFile in objFiles
With objFile
.DateCreatd
.DatelastAccessed
.dateLastModified
Next

If the first file is located on the c:\winnt\system32 folder and the second file is on a mapped drive, t:\folder\, how would you use the script to compare and then execute a file if the dates are equal? I really appreciate the help. You right about the previous method I was using, does not work well everytime.

Thanks again,
Vince.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top