Kaseya Community

Problem Checking Registry key in IF

This question is not answered

I am currently running Kaseya version 5.1.  I will be upgrading to 6 in the very near future, so if the upgrade corrects my problem, please let me know.

I am having trouble checking a registry value in the IF portion of a script.  The script is used to check if Backup Exec Debug Logging is enabled.  If the value of the key is equal to 1, I want to run the IF portion and create a script and event log entry, if not the else portion.  I can't seem to get the registry value detected correctly.  The details of my script are below.  I have tried various forms of "1" in the equals field.  If it's set to 1, 00000001, or 0x00000001 it always runs the ELSE portion.  If it's set to dword:00000001, it always runs the the IF portion.  I have tired both "=" and contains.  Can anyone help me with what I am doing wrong?

Thanks in advance.

IF Check Registry Value
   Parameter 1 : HKEY_LOCAL_MACHINE\SOFTWARE\Symantec\Backup Exec for Windows\Backup Exec\Engine\Logging\CreateDebugLog
   = :1
THEN
   Write Script Log Entry
     Parameter 1 : Backup Exec Debug Logging was detected.
         OS Type : 0
   Execute Shell Command
     Parameter 1 : eventcreate /L APPLICATION /T INFORMATION /SO Kaseya /ID 901  /D "Backup Exec debug logging enabled"
     Parameter 2 : 1
         OS Type : 0
ELSE
   Write Script Log Entry
     Parameter 1 : Backup Exec Debugging not detected.
         OS Type : 0

All Replies
  • eperson

    I am running K2 (6.0). I have a server running Backup Exec. I tested a quick script to test the key you mentioned to display a message is the key was 0 or run an else with a different message if the key was set to 1.  I can confirm that it does indeed work perfectly fine in K2.

    K2 only exports scripts to XML. But incase you want it here it is.

    <?xml version="1.0" encoding="utf-8"?>

    <ScriptExport xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:xsd="www.w3.org/.../XMLSchema" xmlns="www.kaseya.com/.../Scripting">

     <Procedure name="reg check test" treePres="3">

       <Body description="">

         <If description="">

           <Condition name="CheckRegistryValue">

             <Parameter xsi:type="StringParameter" name="RegistryPath" value="HKEY_LOCAL_MACHINE\SOFTWARE\VERITAS\Backup Exec\Engine\Logging\CreateDebugLog" />

             <Parameter xsi:type="EnumParameter" name="Condition" value="Equals" />

             <Parameter xsi:type="StringParameter" name="Value" value="1" />

           </Condition>

           <Then>

             <Statement description="Display a message dialog to the user." name="SendMessage" continueOnFail="false">

               <Parameter xsi:type="StringParameter" name="Message" value="The Key is set to 1" />

               <Parameter xsi:type="BooleanParameter" name="Immediate" value="True" />

             </Statement>

           </Then>

           <Else>

             <Statement description="Display a message dialog to the user." name="SendMessage" continueOnFail="false">

               <Parameter xsi:type="StringParameter" name="Message" value="The Key is set to 0" />

               <Parameter xsi:type="BooleanParameter" name="Immediate" value="True" />

             </Statement>

           </Else>

         </If>

       </Body>

     </Procedure>

    </ScriptExport>

  • In Kaseya value dword:00000001 = 1 for registry values.

    Things I would check are;

    • 64bit OS's, need to build your scripts wot work with 64bit versions or you will run into troubles
    • Check that the key exists before you check for the value
    • You could read the Registry value into a variable and then check it with a "If variable exists" + "If variableis equal to 1" if statement but since you are still using Kaseya 5.x this might be to much work :P