Compare File Modified Dates to Trigger Installed App Update

ndaniel Maryland, USAMember, Managed Service Provider CHOCOLATE MILK

My goal is to create a script that downloads an MSI installer from the web and then checks both the File Modified Date of that MSI and the currently installed application EXE. Then, if the installed application File Modified Date is older, it will automatically run the MSI installer which overwrites (updates) the app.

I've got everything EXCEPT the comparison of the File Modified Dates. Downloading the MSI works. Running the installer to update/overwrite the existing install works. The gathering of the File Modified Date variables for each file works. But I, for the life of me, cannot figure out how to compare the two using Kaseya's Agent Procedure scripting. I just want to figure out "is valueA older than valueB?"

Any ideas?

1 votes

Awaiting Votes · Last Updated


  • Tom Fehlberg
    Tom Fehlberg Outer Banks of North CarolinaMember, Managed Service Provider DECAF

    As long as the date is in format YYYYMMDD you should be able to do a simple eval() command in the Agent Procedure and then ...

    IF eval (valueA is less than valueB)

    PERFORM the rest of the procedure

  • CAmori
    CAmori Washington DC areaMember CHOCOLATE MILK

    @ndaniel , if you can't get the eval() to work, you might need to write a PowerShell command to compare the two values and report back. BTW, make sure you are not re-inventing the wheel, be sure to look on Automation Exchange, or HTTPS:// to see if there is already a script to do what you want.