Kaseya Community

Compare file time stamps from two different computers using variables

  • Greetings,

    I am trying to put together a set of scripts that can pull the time stamp on one computer and check it against another computer using a different script. For Example,

    ComputerA - Runs ScriptA - Creates VarA and places the time stamp inside it
    ComputerB - Runs ScriptB - Creates VarB and places the time stamp inside it

    Master Script Calls Script A first, collects value, launches Script B, collects second value and compares the two using an IF statement.

    As you have probable guessed, it didnt work. I am assuming that you cant carry over Variables from one script to another.

    So, I have the idea of updating a vSystemInfo field I would create for each computer and then compare the two variables directly off of the KServer.

    The only problem, How do I pull this data our of the database?

    Legacy Forum Name: Compare file time stamps from two different computers using variables,
    Legacy Posted By Username: ITRTech
  • If you store the data in a SystemInfo custom field, call it in a script like this:

    #vSystemInfo.#, i.e. if you had a field called TimeStamp in Audit, use this: #vSystemInfo.TimeStamp#

    Cheers,
    Josh

    EDIT: Having said that, variables WILL carry from one script to another providing you are executing the second script from *within* the first, not just concurrently or on the same machine. So perhaps there may have been something else causing a problem. To test, try adding a step in the second script 'Write Procedure Log Entry', then in the field for that step, put the two variables in question. After running you should see evidence in the logs of the two values.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: josh.tipping
  • Thanks for the information Josh. Although, I have run into another stumbling block.

    I can attack this problem two ways.

    1. create a master script that calls two separate scripts that go out and find the variable, and then pull those variables back to the master script and compare the values

    2. create a master script that calls two separate scripts that go out and find the variable but place the data in a custom field under system info. The master script compares the values from each field and compares them.

    Problem:

    How do you run the second script or pull the system info field on another agent? I've tried updating the SQL expression to include the machine.id such as #MachineID.vSystemInfo.TimeStamp# but that doesnt work. When I go to schedule a procedure to run, it doesn't give me a choice on what machine to run it on.

    Confused

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: ITRTech