Kaseya Community

Check Variable in the IF Statement

  • We are in the process of change a couple of our scripts that have been sending files to a group of computer directly from the KServer.

    In doing this:


    1. We are going through the groups and choosing aserver that has ample space to accommodatethe space requirement we are looking for.
    2. We are creating a share on the chosen server.
    3. Setting a Variable with in the KServer Variable area.
    4. Changing the IF statement to test to see if this Variable exist for the group the script is running on. If not the ELSE statement does the script the old way, and if it does exist it uses the THEN process which is the new way.
    This all sounds great, and looks as though it should work within the scripting using the IF Statement "Check Variable", which states "Enter a variable name. Use #name# for a variable defined from a GetVariable step or for a managed variable. " If the variable does exist the script works perfect by using the THEN Process. However, if the Variable is not present on the group in which the script is ran it produces an error in the Script Log stating:





    3:26:46 am 15-Mar-06 Script Name
    Script Summary: Failed in the if step

    3:26:46 am 15-Mar-06 Script Name
    FAILED to loadScript Name(ID = 97175012). Error: Script Variable Not Found

    The IF Statement area is setup with the drop box set to Check Variable. The first line of the statement has the variable name , which is correct but not in all groups. The drop down under this line is set to "Exists", and the line following that drop down box is blank. This as it appears should look to see if the Variable Exist, and if not go to the ELSE process.

    Am I missing something, or is this not as it appears?


    Legacy Forum Name: Check Variable in the IF Statement,
    Legacy Posted By Username: MSWEBS
  • So to make sure I understand this you are specifying a Variable in the "manage Variable" area for a particular group then you are checking for its existence before continuing?

    God Bless,

    Marty


    Legacy Forum Name: Script Discussion,
    Legacy Posted By Username: MissingLink
  • That is correct. If the Variable exists the THEN process should run. If it does not exist the ELSE process should run.

    Legacy Forum Name: Script Discussion,
    Legacy Posted By Username: MSWEBS
  • Has anyone got anything they can help with this issue?

    Legacy Forum Name: Script Discussion,
    Legacy Posted By Username: MSWEBS