just a quick one.
I'm not having trouble with scripting any type of agent procedures, i just want some feedback on people experiences with Kaseya and Agent procedures.
I got heavily into vbScripting, and using an AgentProcedure to do nothing more than run it.
It seems Kaseyas scripting language is mighty powerful, but is there an advantage using it over sending a vbscript to a machine and executing it?
+'s and -'s for Kscript vs vbscript if anyone wants to chip in.
At present i use vbscript because as soon as my vbscript runs, i can get it to report back to kaseya, without relying on kaseya if that makes sense.
Alot of my vbscripts contain
"if value > whatever amountthen mailto:kaseyavsa.etcetc.com
and that is working a treat.
Let me know your thoughts
I would recommend doing all of your mailing out of Kaseya rather than VBScript for the simple reason that otherwise your alerts are all coming from different places. However, once you move past that, I'll start you off:
+Do pretty much anything you want, quickly.
+Not limited by built-in functions
-Very hard to catch errors
-You have to make sure you're coding for "Script ran succesfully with no errors, but did not find problems" vs just saying "Did it find problems" (ie, Error Handling in VB is terrible)
-As you grow you have to version manage your scripts and you probably don't want to send the file every time
+All reporting is centralized
+You can report easily when a script fails, vs didn't execute
+Version control is done server-side rather than client-side
-Not unlimited as far as options go
-Sometimes cumbersome to complete simple tasks
It may just be that i'm incompetent, but here are my gruntagious options.
- editor is painfully slow (and thus, coding is both painful and slow)
- the representation of a command line is long and the words therein are not the same ones as you get with the dropdown menus and the words do not necessarily come in right order the
- redirects on shell commands are... weird (how many > signs do i need?)
- debugging is hard ("FAIL in step three")
- can't do simple arithmetics with variables (i++)
- no loops (for, foreach, while, do-until)
+ Some kind of live syntax checking
I would love to have a Really Nice scripting language with Kaseya. PowerShell, for example.
would have to agree with Robin, I do a good bit with auto IT and also vbscript / powershell.
K2 scripting is better but the interface is clunky and slow and as a script grows it just gets slower and slower.
I like the other tools as they are local to my machine and I can play away and then write a script with kaseya that is short that just delivers them.
I was thinking that having an offline version of the kaseya scripting would be useful so you would download a tool from your kaseya that would look identical to the New script window and then once your finished it just saves as an XML and you just import it into kaseya - would speed up script writing sometime massive.
Many thanks for the replies, this confirms that i wasn't doing the "wrong thing" with vbScripting. (Powershell is my next venture). I have been using vbScripts to interrogate WMI / CMIV(??) and have been getting amazing results.
I used Autoit at an old job, will defnitely relook at it.
Got into Scriptomatic aswell, thats pretty darn powerful / means i don't have to do much to get the results i'm after.
Agree that it would be good if there was an offline version of kscript, i guess the language is relatively "new' compared to the alternatives.
thanks again, Mark.
Im a total newb coming into Kaseya, still busy learning the in's and out's.. However, scripting is something I'm not really that familiar with, can do a few basic batch files and that is about it.
Now could anyone perhaps please direct me to any resources on learning and picking up the scripting language in kaseya, or perhaps any other scripting language so I can self train myself?
I'd be much appreciated for any assistance or tutoring to learn some scripting.
@Shea I've found the easiest way yo learn the Kaseya scripting language is by creating scripts, sart really basic and make them more elaborate. Reverse engineering the scripts that come built into the system would be my next step up the ladder. If you sit and methodically take the scripts apart (figuratively at least) you will very quickly get an idea of how things work.
I'm no seasoned Veteran with Kaseya yet, but I'll jump in here with my two cents. The scripting / procedures in Kaseya seems to be easiest to pick up if you jump into some of the sample procedures, and figure out what they're doing and then how they did it. I also am finding that I have to sort of get myself back to thinking about things in terms of being back at a DOS prompt, and then working things as if I were there. Not too tough, but then I have a lot of years with Unix machines behind me, so command prompts aren't that unfamiliar.
Start with a few simple procedures, and before you know it you'll be able to build up something big that will really make your life easier. But don't re-invent the wheel if you don't have to, there is a ton of useful stuff in the sample procedures.
I've had to use AutoIT to do some of the things we need to do, but I write an AutoIT script, compile it, send it out to the machine and still preform the actual execution with an agent procedure so I can take advantage of the scheduling and such.
I also figured out pretty quickly that it pays to write log entries a lot with your first few scripts, as those are your best chance for successful debugging when things don't go quite the way you planned.
Another thing I found was that it pays to get familiar (or more familiar) with registry keys. I think a lot of the power in the procedures comes from being able to read / write registry keys.
I do wish there was a few more capabilities within the procedures, it would be nice to be able to execute some sort of loop at times. But even with a few limitations, procedures are by far the real key to getting your moneys' worth out of Kaseya.
The first time I scheduled one procedure across 125+ workstations to change one security setting for one customer, I was hooked!! Trust me, the time you spend learning how to use procedures today will come back to you tenfold a month from now!
@Shea Kaseya scripting language is very easy to pickup for
the most part and has a very simple IF Then ELSE structure. In K2 you can even
skip the IF statements and just us it to execute any of your existing Batch and
VB scripts. I would agree with some of the other post and that the easiest way
to learn is to look at exiting script and make your own. Pick something you
want to do via a script and start small and always test your scripts against
test machines never production machines as you never know what might happen.
There are none of the more advanced function (Arrays, Loops
etc...) that other scripting languages uses so at times it can feel limited. By far
the most useful feature is the Database Views variables; http://help.kaseya.com/WebHelp/EN/VSA/6000100/index.htm?toc.htm?2701.htm
If you want training material have a look under the Kaseya
Customer Portal they have some very basic training material. The online Help
file will also help explain what some of the commands are for. http://portal.kaseya.net/KaseyaCustomerPortal/Logon.aspx
I have posted a good number of rich procedures in the Resources section now, some of them even have "while" loop functionality used.
If you are in K2 with recent hotfixes the procedure editor is fine when it comes to performance.
Every now and then I've run into validation errors which I quickly send into engineering, but once we moved all processing to the client/browser it was much easier to work with. I have some procedures that must be 100 lines long now - they may take a few moments to load at first, but once they do I have no problem working with a large script.
You can easily use any language you want within them, whether that be powershell, vbscript, bash (linux/mac) etc.
I'm hoping we can build in OR / AND conditions to our IF statements, along with make some other enhancements for more supported looping one day, but I've been able to get an incredible amount of mileage out of what we have.
Check some of the procedures in this file, one in particular highlights a great usage of Powershell within an agent procedure, using it to join a Win7 machine to an AD domain:
You'll need 6.0.1 to use the 'global' variable procedures (youll see them as #global:variablename#.
@Ben Gosh, I wish we could have you at the Advanced scripting Boot camp here in NZ then I would not even bother to ask what they are going to teach us. I take it you do the loops by checking for a condition and doing an execute same procedure in X min?
Global variables are awesome, have noticed though that Execute Command Shell lines don't like them and that you have to re-read them into a normal script variable to get around it. My last update was 17Nov and it might have changed since then though.
Thanks for the loot
Thanks guys, I'll take the advice and study some of the scripts and resources and hopefully make a few additions to the samples.
Much appreciated for the feedback!
On the loop topic, correct.
It can be dangerous as you don't want to get stuck in an infinite loop so I watch what happens at execution time carefully. I create a loop by setting some sort of variable at the agent in the system registry and then having a 'schedule procedure' operation somewhere in the procedure that will just schedule the same procedure again and it will run the IF check looking for that registry key. I even use get variable 'expression value' to increment an integer (x=x+1) sometimes as my variable if it isn't just a simple boolean (yes/no).
I would not train new Kaseya users on how to do this in a boot camp necessarily , it's pretty advanced stuff :)
HardKnox - are you going to the boot camp in December in Auckland?
I was talking with Sim Bong and he was suggesting it to me when he knows I have been using K for a couple of years now, so I assume it doesn't have to be a newbie course depending on the crowd.
I'm considering it... Can't tell if it would be worth it though.
Hi Ben, a number of your procedures reference files we don't have on our VSA, are you able to supply the files to go with your scripts?