Kaseya Community

Agent procedure execution only if previous agent procedure was successfull.

This question is not answered

Hi guys,

I'm pretty new to Kaseya and I need a little help. I have chained agent procedure which consists of two APs.

For background information I'm uninstalling MS Office 2007 and installing newer version of MS Office, so basically I have 1 AP for uninstallation process and 2 AP for installation process. I want to run 2 AP only if 1 AP was ended with success.

Could you please point me how can I gather 1 AP status and trigger 2 AP execution based on procedure status of 1 AP?

GOAL: If 1 AP will end with CUCCESS, then 2 AP will be triggered. If 1 AP will end with FAILED status, then 2 AP shouldn't be triggered.

Thank you in advance for help,


All Replies
  • Hi Peeter,

    Success or Failure on a procedure only tells you whether the procedure steps completed, not that they accomplished what they were designed to do.  Therefore it is usually better to come up with a positive verification that your first procedure accomplished its task....check that the files have been removed or similar...rather than simply determine that it finished running

  • Hi Karoded,

    Thank you for quick reply.

    I've heard that verification based on file or directory existence is not very good and not working for 100%. I'm thinking now that I can give a try and check registry key for existence after removal.

    For x64 system it's: HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftOffice12.0

    I just need to verify that it will be removed during Office 2007 uninstallation process and will not leave that one for some reason.

    Is there any better way to check successful uninstallation of MS Office 2007 in your practice?



  • yes am I also looking for a better way to check the successful uninstallation of MS Office 2007 in your practice?

  • I agree with

    Honestly I have utilized files and even taken it a next level looking for certain values for additional automation.  

    The registry is a good place to start.

  • Hi,

    Does anybody used OffScrub07.vbs for all old Office 2007 editions uninstallation? I've tested this script manually and it did good job. Now I will try to execute it via Kaseya AP and see how it will work.

  • We deliver several "threaded" procedures and use various methods to control what happens.

    Some procedures use global variables to pass a status value from procedure to procedure.

    We utilize the executeShellCommandToVariable quite a bit. The trick here is to make sure your application / script sends just what you want to StdOut. Open a command prompt and run %COMSPEC% /c {your command} > C:\Temp\test.txt - is the txt file created? Does it have the content you need? If so, the procedure should work. If it doesn't, figure out why and fix it. In some cases, scripts actually call %COMSPEC% /c Echo {var} to make sure the output is written to StdOut.

    Use getVariable(file, filespec, var) to load the contents of a log file into a variable. You can then use "If variable contains" logic to parse the log and perform several possible events. I usually delete the file from the procedure first to make sure I only get results from the current execution.

    Our "New Agent Onboarding" procedure set conditionally runs a set of 4 procedures, which invoke other procedures depending on what was detected.

    Definitely doable.


  • Thank you Glenn,

    It's valuable information for me. I was able to implement procedure and run OffScrub07.vbs script to remove old installations of Office 2007 what I defined in command line. Now I will think about logic and execution of second procedure which will install new Office version.

    Thank you all for your help information!

  • Can you please post your script (if you don't mind)? We are about to migrate a client from Office 2007 to Office 2016.

  • I want to implement restart after MS_Office_2007_VBS_uninstall procedure so that this procedure will resume after computer will be restarted and will continue with MS Office 2016 installation. But as I'm pretty new to Kaseya I will check options :)