Kaseya Community

New to scripting, so where do I start?

  • Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

    I am new to Kaseya and a complete noob when it comes to scripting. I noticed that people use all types scripts, but I have no clue what to start with.

    What scripting language would you recommend for a complete beginner for Kaseya?


  • It helps to have a background with batch and VB scripting, but it is not required to get around with Kaseya. I would definitely start with the Kaseya Help file (it's a question mark in the top-left under your logo). From there, the vast majority of us learned by doing and tested what Kaseya is capable of in a lab environment. Another great way to learn is to study scripts written by others. If you come acrossed something specific that doesn't make sense to you, try researching or ask about it here.

    Good luck.

  • Thank you!

  • The main thing that I had to get used to when I started was realising the capabilities of each different "language" and how to communicate between them when you need to use multiple languages in one script.

    A few examples of this:

    If you're using the command line to achieve something, and then getting the results from that process back into your script. You would either output the shell command to a log file, or use "Execute Shell Command - Get Results to Variable".

    If you're writing a VBScript, then it is a good idea to make the script accept parameters, then you can tell it exactly what to do from your Kaseya script by executing a shell command e.g. "cscript myVBScript.vbs param1 param2"

    Because you'll use a lot of text files for transferring data between different languages, some basic command line text parsing skills will be useful:

    For example, using "Find" to pick out lines containing certain content:

    Enter this into a command prompt:   wmic process list brief

    Then enter this:   wmic process list brief | find "cmd.exe"

    The second line uses "find" to pull out the particular process that we want to look at.

    Debugging Kaseya scripts is also not much fun. I've started putting lines in certain parts of my scripts that write debug information to the script log. e.g. "Write to script log: "DEBUG: Is 64-bit". That way, I can tell more easily how far it has got, and which way it went through the (sometimes many) IF-ELSE blocks.

    Anyway, it is obviously far too big a subject to cover in one post, but you'll find a lot of people here who are willing to help and a lot of existing examples. Look at scripts written by others, and if you don't have a lab environment to test on, always make sure you test it on your own PC (or one of your colleagues!) first...

  • Thank you, Simon.

    I excited to jump in and start learning this stuff.

    Also, I thought someone mentioned Lua, should I look into this as well?

    Thanks - it highly appreciated!

  • Hi edwoods,

    There are a bazillion things you might need to learn, but i think the best approach is to be a "script kiddie" to start with. Reverse engineer other peoples scripts. vBscript and Powershell are probably the best ones to reverse engineer.

    Do you use Active Directory anywhere in your travels? Does your company use batch files to mount printers? Look for the equivalent vBscript to mount those printers and learn from there

    Shameless plug: http://www.scribd.com/doc/58803872/Top-Tools-for-Top-Administrators-2

    Its not the best guide to scripting you will ever see but it makes a point and tells you about my experience with programming - it started off badly, and ended well. 
    At the end of the day, it is like deciding what to monitor in Kaseya , tell yourself what your minimum requirements are, and start with a beginning a middle and an end. 

    Like someone above said, maybe get batch files down patch first, introduce yourself to performing a basic function like mapping a network drive
    Say in a batch file to map a network drive you still type net use \\\mysharedfolder

    Whats the difference in a vBscript? I can't be bothered looking it up because its 11:09 at night and i am tired, but there's no difference.

    A good script to start with is one that enumerates files on a drive and outputs them to a text file. I'd strongly suggest finding a script that does that, then seeing what you can add to it. What else could you do with that script that is useful in Kaseya? You could add a list of specific file extensions you want it to find, you could get it to auto delete those files, you could get it to write that data out to HTML, or email it to the customer? Start basic - see what you can add on.

    The number one rule i should have mentioned before all of this - NEVER GIVE UP...I spent days at a time on and off freshening up my skills, you will get there, just stick with it.  

    Don't be afraid to post back here when your code doesn't work, i am happy to look at it, as would most of the community. The best thing about Kaseya's community is that people wont judge you like they do on other forums.

    As for LUA - i have never touched it, Angry Birds was programmed with it - so i never touched it fearing it would consume me and instead of programming for my customers i'd be making super mario copies for the iPhone. It is rediculously powerful and cross platform, the SDK and all that are in there but it might be a little complex - all depends on your aims.

    Scripting and programming whilst similar depending on your goals - can be extremely different things. 

    That's about all i can think of right now - i am sure i will come up with more stuff for you to digest soon - ask me anything :)

  • Awesome.. Thanks for the site Mark!

    I started looking at some "scripts" and a lot refer back to or launch a VBscript. so, I have started with some small commands run disk cleanup, any other simple stuff and starting to building from there.