Kaseya Community

STEP4, system Latest Audit script

  • Hello. I am working on a custom script, that will try to perform the steps in the Latest Audit system Script (which can not be called directly).

    When I look at the script details of the Latest Audit script, there are 4 steps. I understand steps 1-3, but I amnot sure what Step 4 does.

    Here it is

         Parameter 3 : msgIF EXISTS(SELECT scriptId FROM scriptIdTab WHERE scriptId = 1307) BEGIN INSERT INTO scriptAssignment (scriptId,agentGuid,runCount,logLevel,execPeriod,execScriptTime,runAtTime,monthPeriod,actionAdmin) VALUES(1307, #vMachine.agentGuid#, 1, 0, 0, CURRENT_TIMESTAMP, 0, 0, NULL) END
    OS Type : 13
    ELSE


    Can anyone explain what this SQL statement does? I can see that it is inserting something into the scriptAssignment table. Any idea what scriptId = 1307 is?

    Thanks.

    Lloyd

    Legacy Forum Name: STEP4, system Latest Audit script,
    Legacy Posted By Username: lwolf
  • I have no idea. There is no script id 1307 in that table on our kservers...
    So, for both of us, that entry into the scheduled scripts table is being missed due to the "if exist" condition. We have 3 servers...

    Can anyone see a script with this ID? I'd love to get hold of internal developer documentation.

    Legacy Forum Name: General Discussion,
    Legacy Posted By Username: mparr
  • I think you'll find that some of these system scripts are created dynamically and will have different IDs each time they run.

    Legacy Forum Name: General Discussion,
    Legacy Posted By Username: doug.jenkins@ispire.ca
  • but we both have a reference to the same script ID - and I checked 3 kservers... all have the same entry.

    Legacy Forum Name: General Discussion,
    Legacy Posted By Username: mparr
  • You would need to open the SystemScripts.xml file from the Kaseya directory (view in Notepad) and find the script which has ID:1307
    Copy+Paste this into another notepad window and add the headers/footers from another script, but change the Script ID number.
    Copy+Paste the entire script into Kaseya (using the Import Script) function, and after updating the relationship between the 2 scripts you should find it works perfectly.
    I've already done this for the audits, patch scans, etc.

    Legacy Forum Name: General Discussion,
    Legacy Posted By Username: LightJockey
  • Oddly enough - the only reference to that script ID is the step from the script above. It is hard coded into the systemscripts.xml. Maybe it is a legacy script that was deprecated but this was never removed because it didn't cause any bugs - it always returns false on the SQL conditional, so never does anything.

    Thank you for the pointer though. I hadn't come across that file before.

    Legacy Forum Name: General Discussion,
    Legacy Posted By Username: mparr