Kaseya Community

Calling Agent Procedure Functions in Lua

This question is answered

Hello All,

I am new to Kaseya and Lua, and have two questions when it comes to KNM and agent procedures:

  1. Can I make calls to the builtin agent procedure functions such as createEventLogEntry()?
  2. Is there a location where the args for these functions are documented? I have the Agent Procedures user guide but it only lists each function and then a brief description. As it stands, to figure out the args I have to add a function to a blank procedure and look at the steps, which is tedious. Even if I can't embed into my Lua scripts, I'd still much rather write out the Agent Procedures than have to click through drop-down after drop-down.

Thanks in advance!

D

Verified Answer
  • ds_scalar - as far as i can tell you can call most internal functions using this method and combine them in your script with regular steps added from the IDE.  Doing a quick query of the dbo.scriptIdTab table there are hundreds of thousands of script IDs - which i believe are dynamically created.  My hunch is that the internal "stock" hidden scripts are in the lower hundreds.

    For me the biggest thing with Go was the balance of "in the box" capability with ease of distribution.  The built-in packages are not quite as wide reaching as Python or Powershell, but for me they cover 90% of what i want to do.  The killer feature for me is that i can develop in Linux or Windows and easily compile for either platform.  The one downside is that the resulting exe is pretty fat (3+ Megs) so i've developed a few "live update" techniques through Kaseya scripts that help only download the exe if it is needed ( community.kaseya.com/.../19364.aspx)

All Replies
  • I believe this will give you a good start. See community.kaseya.com/.../11812.aspx and look for the post by swhansen.  That user describes how to run "hidden" functions that are not in the interface, but are listed in a special database.

    Honestly, i've ended up using Kaseya to push down binaries i've written in Go since their "IDE" is rather limited.  Happy to share code/techniques if you are interested

    -zach

  • Thanks, Zach. Just to confirm: I should be able to call any function I find in the interface AND the hidden subset mentioned by swhansen? If so, that is great!

    Go is appealing; I come from a systems engineering background so I am fond of Perl, C, PowerShell and similar and the syntax looks pretty friendly. I would love to see some of your binaries.

    What made you choose Go as compared to other low level lang like D or Lua itself for example? Does Go compile to C or to CLR/CLI?

  • Hi zpeters,

    yes, interested in the code / technique if you don't mind sharing ?

  • ds_scalar - as far as i can tell you can call most internal functions using this method and combine them in your script with regular steps added from the IDE.  Doing a quick query of the dbo.scriptIdTab table there are hundreds of thousands of script IDs - which i believe are dynamically created.  My hunch is that the internal "stock" hidden scripts are in the lower hundreds.

    For me the biggest thing with Go was the balance of "in the box" capability with ease of distribution.  The built-in packages are not quite as wide reaching as Python or Powershell, but for me they cover 90% of what i want to do.  The killer feature for me is that i can develop in Linux or Windows and easily compile for either platform.  The one downside is that the resulting exe is pretty fat (3+ Megs) so i've developed a few "live update" techniques through Kaseya scripts that help only download the exe if it is needed ( community.kaseya.com/.../19364.aspx)

  • That's great to know. I try to achieve the write-once, compile-anywhere thing with Perl myself, since it's included in OS X and easy enough to deploy ActivePerl to my Windows machines. CPAN makes it so easy to find modules and new functionality.

    Do you have any Go code samples available for sharing that pertain to KNM / deployments?

    Thanks so much for the helpful input!

    D