Kaseya Community

Email notification for certain files

This question is answered

I am trying to figure out if it is possible to have a scan of a specific folder for a text file, if exists open and read the contents and email results? A long shot I know but will save me a boat load of work if possible.

Thanks.

Mark

Verified Answer
  • Hi  

    Yes, this can be done depending on the file you are trying to read it may get a bit complicated.

    Here is an example of how this can be done with a simple text file which only has one value written to it.

    Text file:

    Procedure:

    Email sent:

    Hope this is what you were looking for.

  • PC Therapist,

    Each variable you create will have a unique variable name.  You'll need to create ("get") each variable in earlier steps in the procedure, then call them later.  Try building the procedure recommends, but add in an additional getVariable step to define the Machine.Group ID.  When you use the sendEmail step, add your Machine.Group ID variable name (surrounded by hashtags) to the subject and/or body.  When building procedures, start with the most basic functionality and test the procedure until you get those steps to work.  Once they're working, add additional complexity a little at a time.  This really cuts down on the pulling-the-hair-out troubleshooting since you narrow down the components that may need rework with each build.

All Replies
  • Hi  

    Yes, this can be done depending on the file you are trying to read it may get a bit complicated.

    Here is an example of how this can be done with a simple text file which only has one value written to it.

    Text file:

    Procedure:

    Email sent:

    Hope this is what you were looking for.

  • Thanks Nicolas,

    It has opened a can of worms though. How would I embed the computer name the email if at all possible?

    Thanks.

    Mark

  • ,

    Use the step getVariable.  When you insert that step, look at the right-hand pane where you can define the options for the step (you can define directly through the line in the editor, but using the 'form' on the right can sometimes be easier when you're using new steps).  The first option allows you to select from a list.  Choose the option "Machine.Group ID".

    In the field where you specify a name for the variable, enter the text you want to use to reference this variable later in the procedure.  For the purposes of this example, I'll use "machname".

    When you call this variable later in the procedure, reference the variable using hashtags surrounding the variable name.  Using the sendEmail step, here's an example:

    A note of recommendation:  when using the sendEmail step, do not hardcode an individual's email address into the procedure.  In order to prevent having to re-edit the procedure every time the recipient's responsibilities change or that individual leaves your organization, find an alternative.  Some suggestions, in order of my personal preference (most to least):

    • Use distribution lists and manage memberships via your email system
    • Prompt the admin at the time of the procedure which address should receive the email (use the getVariable step and choose the last option in the picklist to "prompt" for the variable, then plug the variable response into the TO line of the sendEmail step)
    • Use Manage Variables to define email addresses and call the Manage Variable within your procedure
    • Use Custom Fields to define the correct recipient of emails for a machine, then reference that Custom Field in your procedure

    I find email distro lists the easiest to manage, but you might find a different alternative is preferred in your processes.  I strongly believe using an individual's email address in a procedure is not desirable under almost any circumstances.  It's far too easy to forget which procedures are sending an email to an individual when s/he moves on, and that makes it likely you'll lose sight of notifications you're expecting someone to take action against.  

  • Thanks Brande,

    How does one insert two variables into the body of the email?

    Example;

    Subject: report text

    Body: Machine Name:

    Text file contents.

    Thanks.

    Mark

  • PC Therapist,

    Each variable you create will have a unique variable name.  You'll need to create ("get") each variable in earlier steps in the procedure, then call them later.  Try building the procedure recommends, but add in an additional getVariable step to define the Machine.Group ID.  When you use the sendEmail step, add your Machine.Group ID variable name (surrounded by hashtags) to the subject and/or body.  When building procedures, start with the most basic functionality and test the procedure until you get those steps to work.  Once they're working, add additional complexity a little at a time.  This really cuts down on the pulling-the-hair-out troubleshooting since you narrow down the components that may need rework with each build.

  • Thanks Nicolas and Brande.

    Emails being sent when needed with the correct information in the correct order.

    Thanks again.

    Mark