Happy World Backup Day 🎉 from all of us at Kaseya! Join the Spanning team today at 2pm ET for tales of incredible IT heroics, explore new trends in the #BCDR landscape and play a round of backup trivia for some awesome prizes.

RSVP here: https://bit.ly/3YUS2JY

Compare File Modified Dates to Trigger Installed App Update

ndaniel
ndaniel Member, 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
1 votes

Awaiting Votes · Last Updated

Comments

  • tom@tbkconsulting.biz
    [email protected] Member, Managed Service Provider RED EYE

    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 Member 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://clubmsp.com to see if there is already a script to do what you want.

    Chris