i am trying to use the Deploy Adobe Reader X that Ben L created and when i run this against a machine for the first time nothing happends, If i rerun it then adobe reader x installs.

If i look at the script log i see this but how do i know what each step is in the script.  sorry for the log not being organized properly but having hard time with this new forum posting stuff.

Script Log:

22:08:44 02-Apr-11 Adobe Reader X (Windows) Script Summary: Success THEN 22:08:44 02-Apr-11 Adobe Reader X (Windows)-9 Script Summary: Success ELSE 22:08:43 02-Apr-11 Adobe Reader X (Windows)-9-3 Script Summary: Success THEN 22:08:43 02-Apr-11 Adobe Reader X (Windows)-9-3-2 Script Summary: Success THEN 22:08:43 02-Apr-11 Adobe Reader X (Windows)-9-3-2-3 Script Summary: Failed THEN in step 1 22:08:43 02-Apr-11 Adobe Reader X (Windows)-9-3-2-3 FAILED in processing THEN step 1, Schedule Script, with error Script Not Found 22:08:43 02-Apr-11 Adobe Reader X (Windows)-9-3-2-2 Script Summary: Success ELSE 22:08:43 02-Apr-11 Adobe Reader X (Windows)-9-3-2-1 Script Summary: Success ELSE 22:08:43 02-Apr-11 Adobe Reader X (Windows)-9-3-2-1-Else.8 Script Summary: Success ELSE 22:08:43 02-Apr-11 Adobe Reader X (Windows)-9-3-2-1-Else.9 Script Summary: Success ELSE 22:08:43 02-Apr-11 Adobe Reader X (Windows)-9-3-2-1-Else.10 Script Summary: Success THEN 22:07:25 02-Apr-11 Start KLC on andt01.classicxray.valcon - 270752753 Script Summary: Success THEN 22:04:53 02-Apr-11 Adobe Reader X (Windows)-9-3-2-1-Else.10 Adobe Reader X Installer not present. Downloading from internet... 22:04:52 02-Apr-11 Adobe Reader X (Windows)-9-3-1 Script Summary: Success ELSE 22:04:52 02-Apr-11 Adobe Reader X (Windows)-9-3-1-Else.6 Script Summary: Success ELSE 22:04:52 02-Apr-11 Adobe Reader X (Windows)-9-3-1-1 Script Summary: Failed in the if step 22:04:52 02-Apr-11 Adobe Reader X (Windows)-9-3-1-1 FAILED in processing IF step, Check Variable, with error Script variable is undefined. It must be defined by a GetVariable step earlier in this script or a parent script. 22:04:52 02-Apr-11 Adobe Reader X (Windows)-9-3-1-Else.6 Adobe Reader X not present. Installing for the first time. 22:04:52 02-Apr-11 Adobe Reader X (Windows)-9-3-1-Else.6 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\68AB67CA7DA73301B744AA0000000010\InstallProperties\Version not found. 22:04:51 02-Apr-11 Adobe Reader X (Windows)-9-2 Script Summary: Success THEN 22:04:51 02-Apr-11 Adobe Reader X (Windows)-9-2 Installcount variable does not exist yet. Setting to 0 in HKEY_LOCAL_MACHINE\Software\Kaseya\Adobe Reader X-installcount 22:04:50 02-Apr-11 Adobe Reader X (Windows)-9-1 Script Summary: Success ELSE 22:04:50 02-Apr-11 Adobe Reader X (Windows)-8 Script Summary: Success ELSE 22:04:49 02-Apr-11 Adobe Reader X (Windows)-7 Script Summary: Success ELSE 22:04:49 02-Apr-11 Adobe Reader X (Windows)-6 Script Summary: Success ELSE 22:04:49 02-Apr-11 Adobe Reader X (Windows)-5 Script Summary: Success ELSE 22:04:49 02-Apr-11 Adobe Reader X (Windows)-4 Script Summary: Success ELSE 22:04:49 02-Apr-11 Adobe Reader X (Windows)-3 Script Summary: Success ELSE 22:04:49 02-Apr-11 Adobe Reader X (Windows)-2 Script Summary: Success ELSE 22:04:49 02-Apr-11 Adobe Reader X (Windows)-1 Script Summary: Success ELSE 22:04:36 02-Apr-11 Run Now - Adobe Reader X (Windows) Admin scheduled procedure Run Now - Adobe Reader X (Windows) to run at Apr 2 2011 10:04PM

 

 

 

 

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

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

  <Procedure name="Adobe Reader X (Windows)" treePres="3">

    <Body description="This procedure deploys Adobe Reader from the configured agent file source under Patch Management.  &#xA;&#xA;YOU MUST READ THIS FIRST. &#xA;&#xA;1) Modify the two 'Schedule Procedure' steps at the bottom to reference THIS procedure. This must be done first.&#xA;&#xA;2) installcycles and resetinstallcount variables do not need to be changed unless you wish to change them. &#xA;&#xA;Click on each step to read more about it. &#xA;&#xA;Enjoy!&#xA;benjamin.lavalley@kaseya.com&#xA;&#xA;&#xA;&#xA;&#xA;">

      <Statement description="'reader' is the name of the folder and files associated with updating Adobe Reader on the Kaseya update site. " name="GetVariable" continueOnFail="false" osType="Windows">

        <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

        <Parameter xsi:type="StringParameter" name="SourceContent" value="readerX" />

        <Parameter xsi:type="StringParameter" name="VariableName" value="app" />

      </Statement>

      <Statement description="This is the download URL for the application. " name="GetURL" continueOnFail="false" osType="Windows">

        <Parameter xsi:type="StringParameter" name="URL" value="http://files.kaseya.com/sftp/appupdates/#app#/#app#-url.txt" />

        <Parameter xsi:type="StringParameter" name="ResponseFileName" value="#vagentconfiguration.agenttempdir#\#app#-url.txt" />

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

      </Statement>

      <Statement description="This is the title of the application. " name="GetURL" continueOnFail="false" osType="Windows">

        <Parameter xsi:type="StringParameter" name="URL" value="http://files.kaseya.com/sftp/appupdates/#app#/#app#-appname.txt" />

        <Parameter xsi:type="StringParameter" name="ResponseFileName" value="#vagentconfiguration.agenttempdir#\#app#-appname.txt" />

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

      </Statement>

      <Statement description="This is the file name of our downloaded application." name="GetURL" continueOnFail="false" osType="Windows">

        <Parameter xsi:type="StringParameter" name="URL" value="http://files.kaseya.com/sftp/appupdates/#app#/#app#-filename.txt" />

        <Parameter xsi:type="StringParameter" name="ResponseFileName" value="#vagentconfiguration.agenttempdir#\#app#-filename.txt" />

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

      </Statement>

      <Statement description="This is the byte size of our downloaded application. " name="GetURL" continueOnFail="false" osType="Windows">

        <Parameter xsi:type="StringParameter" name="URL" value="http://files.kaseya.com/sftp/appupdates/#app#/#app#-bytes.txt" />

        <Parameter xsi:type="StringParameter" name="ResponseFileName" value="#vagentconfiguration.agenttempdir#\#app#-bytes.txt" />

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

      </Statement>

      <Statement description="This is the registry key to check if the application exists and what version it is" name="GetURL" continueOnFail="false" osType="Windows">

        <Parameter xsi:type="StringParameter" name="URL" value="http://files.kaseya.com/sftp/appupdates/#app#/#app#-regkey.txt" />

        <Parameter xsi:type="StringParameter" name="ResponseFileName" value="#vagentconfiguration.agenttempdir#\#app#-regkey.txt" />

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

      </Statement>

      <Statement description="This is the latest expected version number from the previous registry key check. " name="GetURL" continueOnFail="false" osType="Windows">

        <Parameter xsi:type="StringParameter" name="URL" value="http://files.kaseya.com/sftp/appupdates/#app#/#app#-ver.txt" />

        <Parameter xsi:type="StringParameter" name="ResponseFileName" value="#vagentconfiguration.agenttempdir#\#app#-ver.txt" />

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

      </Statement>

      <Statement description="These are the silent install switches" name="GetURL" continueOnFail="false" osType="Windows">

        <Parameter xsi:type="StringParameter" name="URL" value="http://files.kaseya.com/sftp/appupdates/#app#/#app#-installswitches.txt" />

        <Parameter xsi:type="StringParameter" name="ResponseFileName" value="#vagentconfiguration.agenttempdir#\#app#-installswitches.txt" />

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

      </Statement>

      <Statement description="If an application is running that prevents us from installing, terminate it. " name="GetURL" continueOnFail="false" osType="Windows">

        <Parameter xsi:type="StringParameter" name="URL" value="http://files.kaseya.com/sftp/appupdates/#app#/#app#-terminate.txt" />

        <Parameter xsi:type="StringParameter" name="ResponseFileName" value="#vagentconfiguration.agenttempdir#\#app#-terminate.txt" />

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

      </Statement>

      <Statement description="Possible shell commands for a 32-bit OS." name="GetURL" continueOnFail="true" osType="Windows">

        <Parameter xsi:type="StringParameter" name="URL" value="http://files.kaseya.com/sftp/appupdates/#app#/#app#-32bit-cmd.bat" />

        <Parameter xsi:type="StringParameter" name="ResponseFileName" value="#vagentconfiguration.agenttempdir#\#app#-32bit-cmd.bat" />

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

      </Statement>

      <Statement description="Possible shell commands for a 64-bit OS." name="GetURL" continueOnFail="true" osType="Windows">

        <Parameter xsi:type="StringParameter" name="URL" value="http://files.kaseya.com/sftp/appupdates/#app#/#app#-64bit-cmd.bat" />

        <Parameter xsi:type="StringParameter" name="ResponseFileName" value="#vagentconfiguration.agenttempdir#\#app#-64bit-cmd.bat" />

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

      </Statement>

      <Statement description="This is the URL to download the file. If it does not exist on a public site, you can place it on your Kaseya Server under Kaseya\WebPages and access it as http://yourkaseyaserveraddress/yourfilename.exe" name="GetVariable" continueOnFail="false" osType="Windows">

        <Parameter xsi:type="EnumParameter" name="VariableType" value="FileContent" />

        <Parameter xsi:type="StringParameter" name="SourceContent" value="#vagentconfiguration.agenttempdir#\#app#-url.txt" />

        <Parameter xsi:type="StringParameter" name="VariableName" value="downloadurl" />

      </Statement>

      <Statement description="This is the title of the application." name="GetVariable" continueOnFail="false" osType="Windows">

        <Parameter xsi:type="EnumParameter" name="VariableType" value="FileContent" />

        <Parameter xsi:type="StringParameter" name="SourceContent" value="#vagentconfiguration.agenttempdir#\#app#-appname.txt" />

        <Parameter xsi:type="StringParameter" name="VariableName" value="appname" />

      </Statement>

      <Statement description="This is the name of the application process -- a &quot;close application&quot; step will run to ensure the application is not running when we start the installation. " name="GetVariable" continueOnFail="false" osType="Windows">

        <Parameter xsi:type="EnumParameter" name="VariableType" value="FileContent" />

        <Parameter xsi:type="StringParameter" name="SourceContent" value="#vagentconfiguration.agenttempdir#\#app#-terminate.txt" />

        <Parameter xsi:type="StringParameter" name="VariableName" value="appexe" />

      </Statement>

      <Statement description="This is the name of the file you are downloading. " name="GetVariable" continueOnFail="false" osType="Windows">

        <Parameter xsi:type="EnumParameter" name="VariableType" value="FileContent" />

        <Parameter xsi:type="StringParameter" name="SourceContent" value="#vagentconfiguration.agenttempdir#\#app#-filename.txt" />

        <Parameter xsi:type="StringParameter" name="VariableName" value="filename" />

      </Statement>

      <Statement description="This is the byte count of the file you wish to download. This ensures the file is intact before the installation begins. " name="GetVariable" continueOnFail="false" osType="Windows">

        <Parameter xsi:type="EnumParameter" name="VariableType" value="FileContent" />

        <Parameter xsi:type="StringParameter" name="SourceContent" value="#vagentconfiguration.agenttempdir#\#app#-bytes.txt" />

        <Parameter xsi:type="StringParameter" name="VariableName" value="bytecheck" />

      </Statement>

      <Statement description="This is the registry key you will use to check the version of the application. " name="GetVariable" continueOnFail="false" osType="Windows">

        <Parameter xsi:type="EnumParameter" name="VariableType" value="FileContent" />

        <Parameter xsi:type="StringParameter" name="SourceContent" value="#vagentconfiguration.agenttempdir#\#app#-regkey.txt" />

        <Parameter xsi:type="StringParameter" name="VariableName" value="regkey" />

      </Statement>

      <Statement description="This is the version you will be checking the registry against. This is used during pre-installation to determine if the install should proceed and it is used post-installaton to determine if the upgrade was successful. " name="GetVariable" continueOnFail="false" osType="Windows">

        <Parameter xsi:type="EnumParameter" name="VariableType" value="FileContent" />

        <Parameter xsi:type="StringParameter" name="SourceContent" value="#vagentconfiguration.agenttempdir#\#app#-ver.txt" />

        <Parameter xsi:type="StringParameter" name="VariableName" value="regver" />

      </Statement>

      <Statement description="This is an installation command. You may only need one or you may need several. This sample uses msiexec to install and MSI but it can consist of any shell command you wish." name="GetVariable" continueOnFail="false" osType="Windows">

        <Parameter xsi:type="EnumParameter" name="VariableType" value="FileContent" />

        <Parameter xsi:type="StringParameter" name="SourceContent" value="#vagentconfiguration.agenttempdir#\#app#-installswitches.txt" />

        <Parameter xsi:type="StringParameter" name="VariableName" value="installswitches" />

      </Statement>

      <Statement description="The number of times to allow the installation routine to recycle before we give up. This is stored on the agent in the following location if you wish to reset it: HKEY_LOCAL_MACHINE\Software\Kaseya\#appname#-installcount" name="GetVariable" continueOnFail="false" osType="Windows">

        <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

        <Parameter xsi:type="StringParameter" name="SourceContent" value="10" />

        <Parameter xsi:type="StringParameter" name="VariableName" value="installcycles" />

      </Statement>

      <Statement description="If you set this to anything other than 'no', the procedure will ignore the install cycle count. The possible issue with this lies in allowing for a possible infinite loop scenario if there is a problem with the install logic. " name="GetVariable" continueOnFail="false" osType="Windows">

        <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

        <Parameter xsi:type="StringParameter" name="SourceContent" value="no" />

        <Parameter xsi:type="StringParameter" name="VariableName" value="resetinstallcount" />

      </Statement>

      <Statement description="Delete the specified file - full path to the filename required." name="DeleteFile" continueOnFail="true" osType="Windows">

        <Parameter xsi:type="StringParameter" name="Path" value="#vagentconfiguration.agenttempdir#\#app#-url.txt" />

      </Statement>

      <Statement description="Delete the specified file - full path to the filename required." name="DeleteFile" continueOnFail="true" osType="Windows">

        <Parameter xsi:type="StringParameter" name="Path" value="#vagentconfiguration.agenttempdir#\#app#-appname.txt" />

      </Statement>

      <Statement description="Delete the specified file - full path to the filename required." name="DeleteFile" continueOnFail="true" osType="Windows">

        <Parameter xsi:type="StringParameter" name="Path" value="#vagentconfiguration.agenttempdir#\#app#-terminate.txt" />

      </Statement>

      <Statement description="Delete the specified file - full path to the filename required." name="DeleteFile" continueOnFail="true" osType="Windows">

        <Parameter xsi:type="StringParameter" name="Path" value="#vagentconfiguration.agenttempdir#\#app#-filename.txt" />

      </Statement>

      <Statement description="Delete the specified file - full path to the filename required." name="DeleteFile" continueOnFail="true" osType="Windows">

        <Parameter xsi:type="StringParameter" name="Path" value="#vagentconfiguration.agenttempdir#\#app#-bytes.txt" />

      </Statement>

      <Statement description="Delete the specified file - full path to the filename required." name="DeleteFile" continueOnFail="true" osType="Windows">

        <Parameter xsi:type="StringParameter" name="Path" value="#vagentconfiguration.agenttempdir#\#app#-regkey.txt" />

      </Statement>

      <Statement description="Delete the specified file - full path to the filename required." name="DeleteFile" continueOnFail="true" osType="Windows">

        <Parameter xsi:type="StringParameter" name="Path" value="#vagentconfiguration.agenttempdir#\#app#-bytes.txt" />

      </Statement>

      <Statement description="Delete the specified file - full path to the filename required." name="DeleteFile" continueOnFail="true" osType="Windows">

        <Parameter xsi:type="StringParameter" name="Path" value="#vagentconfiguration.agenttempdir#\#app#-ver.txt" />

      </Statement>

      <Statement description="Delete the specified file - full path to the filename required." name="DeleteFile" continueOnFail="true" osType="Windows">

        <Parameter xsi:type="StringParameter" name="Path" value="#vagentconfiguration.agenttempdir#\#app#-installswitches.txt" />

      </Statement>

      <If description="">

        <Condition name="CheckVariable">

          <Parameter xsi:type="StringParameter" name="VariableName" value="#installswitches#" />

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

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

        </Condition>

        <Then>

          <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

            <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

            <Parameter xsi:type="StringParameter" name="SourceContent" value="Install Switches URL not downloaded successfully." />

            <Parameter xsi:type="StringParameter" name="VariableName" value="global:error" />

          </Statement>

        </Then>

      </If>

      <If description="">

        <Condition name="CheckVariable">

          <Parameter xsi:type="StringParameter" name="VariableName" value="#regver#" />

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

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

        </Condition>

        <Then>

          <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

            <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

            <Parameter xsi:type="StringParameter" name="SourceContent" value="Registry Version URL not downloaded successfully." />

            <Parameter xsi:type="StringParameter" name="VariableName" value="global:error" />

          </Statement>

        </Then>

      </If>

      <If description="">

        <Condition name="CheckVariable">

          <Parameter xsi:type="StringParameter" name="VariableName" value="#regkey#" />

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

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

        </Condition>

        <Then>

          <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

            <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

            <Parameter xsi:type="StringParameter" name="SourceContent" value="Registry Key URL not downloaded successfully." />

            <Parameter xsi:type="StringParameter" name="VariableName" value="global:error" />

          </Statement>

        </Then>

      </If>

      <If description="">

        <Condition name="CheckVariable">

          <Parameter xsi:type="StringParameter" name="VariableName" value="#bytecheck#" />

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

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

        </Condition>

        <Then>

          <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

            <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

            <Parameter xsi:type="StringParameter" name="SourceContent" value="File byte check URL not downloaded successfully." />

            <Parameter xsi:type="StringParameter" name="VariableName" value="global:error" />

          </Statement>

        </Then>

      </If>

      <If description="">

        <Condition name="CheckVariable">

          <Parameter xsi:type="StringParameter" name="VariableName" value="#filename#" />

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

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

        </Condition>

        <Then>

          <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

            <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

            <Parameter xsi:type="StringParameter" name="SourceContent" value="Filename URL not downloaded successfully." />

            <Parameter xsi:type="StringParameter" name="VariableName" value="global:error" />

          </Statement>

        </Then>

      </If>

      <If description="">

        <Condition name="CheckVariable">

          <Parameter xsi:type="StringParameter" name="VariableName" value="#appexe#" />

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

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

        </Condition>

        <Then>

          <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

            <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

            <Parameter xsi:type="StringParameter" name="SourceContent" value="Applicatio EXE URL not downloaded successfully." />

            <Parameter xsi:type="StringParameter" name="VariableName" value="global:error" />

          </Statement>

        </Then>

      </If>

      <If description="">

        <Condition name="CheckVariable">

          <Parameter xsi:type="StringParameter" name="VariableName" value="#downloadurl#" />

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

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

        </Condition>

        <Then>

          <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

            <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

            <Parameter xsi:type="StringParameter" name="SourceContent" value="Download URL not downloaded successfully." />

            <Parameter xsi:type="StringParameter" name="VariableName" value="global:error" />

          </Statement>

        </Then>

      </If>

      <If description="">

        <Condition name="CheckVariable">

          <Parameter xsi:type="StringParameter" name="VariableName" value="#appname#" />

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

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

        </Condition>

        <Then>

          <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

            <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

            <Parameter xsi:type="StringParameter" name="SourceContent" value="Application Name URL not downloaded successfully." />

            <Parameter xsi:type="StringParameter" name="VariableName" value="global:error" />

          </Statement>

        </Then>

      </If>

      <If description="">

        <Condition name="CheckVariable">

          <Parameter xsi:type="StringParameter" name="VariableName" value="#global:error#" />

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

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

        </Condition>

        <Then>

          <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

            <Parameter xsi:type="StringParameter" name="Comment" value="Error: #global:error#" />

          </Statement>

        </Then>

        <Else>

          <If description="If this procedure is being run ON the patch management file server, either to deploy the update or to simply download the file for the first time, we will download the file and place it in the share directory. ">

            <Condition name="CheckVariable">

              <Parameter xsi:type="StringParameter" name="VariableName" value="#vpatchconfiguration.FileSourceMachineId#" />

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

              <Parameter xsi:type="StringParameter" name="Value" value="#vagentconfiguration.Machine_GroupID#" />

            </Condition>

            <Then>

              <Statement description="Execute the given command as if it were typed in at a command prompt." name="ExecuteShellCommand" continueOnFail="false" osType="Windows">

                <Parameter xsi:type="StringParameter" name="Command" value="dir &quot;#vpatchconfiguration.FileSourceLocalPath##filename#&quot; &gt;&gt; &quot;#vagentconfiguration.agenttempdir#\#appname#-share-check.txt&quot;" />

                <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />

                <Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />

              </Statement>

              <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

                <Parameter xsi:type="EnumParameter" name="VariableType" value="FileContent" />

                <Parameter xsi:type="StringParameter" name="SourceContent" value="#vagentconfiguration.agenttempdir#\#appname#-share-check.txt" />

                <Parameter xsi:type="StringParameter" name="VariableName" value="sharecheck" />

              </Statement>

              <If description="">

                <Condition name="CheckVariable">

                  <Parameter xsi:type="StringParameter" name="VariableName" value="#sharecheck#" />

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

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

                </Condition>

                <Then>

                  <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                    <Parameter xsi:type="StringParameter" name="Comment" value="#filename# does not exist on share server yet, downloading...." />

                  </Statement>

                  <Statement description="Get the response from a web page." name="GetURL" continueOnFail="false" osType="Windows">

                    <Parameter xsi:type="StringParameter" name="URL" value="#downloadurl#" />

                    <Parameter xsi:type="StringParameter" name="ResponseFileName" value="#vpatchconfiguration.FileSourceLocalPath##filename#" />

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

                  </Statement>

                </Then>

                <Else>

                  <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                    <Parameter xsi:type="StringParameter" name="Comment" value="#filename# already exists on file share. " />

                  </Statement>

                </Else>

              </If>

            </Then>

          </If>

          <If description="">

            <Condition name="CheckRegistryValue">

              <Parameter xsi:type="StringParameter" name="RegistryPath" value="HKEY_LOCAL_MACHINE\Software\Kaseya\#appname#-installcount" />

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

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

            </Condition>

            <Then>

              <Statement description="Set the specified registry value - Regedit displays keys as folders and values as documents." name="SetRegistryValue" continueOnFail="false" osType="Windows">

                <Parameter xsi:type="StringParameter" name="RegistryPath" value="HKEY_LOCAL_MACHINE\Software\Kaseya\#appname#-installcount" />

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

                <Parameter xsi:type="EnumParameter" name="DataType" value="String" />

              </Statement>

              <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                <Parameter xsi:type="StringParameter" name="Comment" value="Installcount variable does not exist yet. Setting to 0 in HKEY_LOCAL_MACHINE\Software\Kaseya\#appname#-installcount" />

              </Statement>

              <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

                <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

                <Parameter xsi:type="StringParameter" name="SourceContent" value="0" />

                <Parameter xsi:type="StringParameter" name="VariableName" value="global:newinstallcount" />

              </Statement>

            </Then>

            <Else>

              <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

                <Parameter xsi:type="EnumParameter" name="VariableType" value="RegistryValue" />

                <Parameter xsi:type="StringParameter" name="SourceContent" value="HKEY_LOCAL_MACHINE\Software\Kaseya\#appname#-installcount" />

                <Parameter xsi:type="StringParameter" name="VariableName" value="installcount" />

              </Statement>

              <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                <Parameter xsi:type="StringParameter" name="Comment" value="Installcount is: #installcount#" />

              </Statement>

              <If description="">

                <Condition name="CheckVariable">

                  <Parameter xsi:type="StringParameter" name="VariableName" value="#installcount#" />

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

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

                </Condition>

                <Then>

                  <If description="">

                    <Condition name="CheckVariable">

                      <Parameter xsi:type="StringParameter" name="VariableName" value="#resetinstallcount#" />

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

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

                    </Condition>

                    <Then>

                      <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

                        <Parameter xsi:type="EnumParameter" name="VariableType" value="ExpressionValue" />

                        <Parameter xsi:type="StringParameter" name="SourceContent" value="#installcount# + 1" />

                        <Parameter xsi:type="StringParameter" name="VariableName" value="global:newinstallcount" />

                      </Statement>

                      <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                        <Parameter xsi:type="StringParameter" name="Comment" value="NewInstallcount is: #global:newinstallcount#" />

                      </Statement>

                      <Statement description="Set the specified registry value - Regedit displays keys as folders and values as documents." name="SetRegistryValue" continueOnFail="false" osType="Windows">

                        <Parameter xsi:type="StringParameter" name="RegistryPath" value="HKEY_LOCAL_MACHINE\Software\Kaseya\#appname#-installcount" />

                        <Parameter xsi:type="StringParameter" name="Value" value="#global:newinstallcount#" />

                        <Parameter xsi:type="EnumParameter" name="DataType" value="String" />

                      </Statement>

                    </Then>

                    <Else>

                      <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                        <Parameter xsi:type="StringParameter" name="Comment" value="Forcibly resetting installcount because variable &quot;resetinstallcount&quot; is set to #resetinstallcount#" />

                      </Statement>

                      <Statement description="Set the specified registry value - Regedit displays keys as folders and values as documents." name="SetRegistryValue" continueOnFail="false" osType="Windows">

                        <Parameter xsi:type="StringParameter" name="RegistryPath" value="HKEY_LOCAL_MACHINE\Software\Kaseya\#appname#-installcount" />

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

                        <Parameter xsi:type="EnumParameter" name="DataType" value="String" />

                      </Statement>

                      <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

                        <Parameter xsi:type="EnumParameter" name="VariableType" value="ExpressionValue" />

                        <Parameter xsi:type="StringParameter" name="SourceContent" value="0" />

                        <Parameter xsi:type="StringParameter" name="VariableName" value="global:newinstallcount" />

                      </Statement>

                    </Else>

                  </If>

                </Then>

                <Else>

                  <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                    <Parameter xsi:type="StringParameter" name="Comment" value="error: unable to determine install count. " />

                  </Statement>

                </Else>

              </If>

            </Else>

          </If>

          <If description="">

            <Condition name="CheckVariable">

              <Parameter xsi:type="StringParameter" name="VariableName" value="#global:newinstallcount#" />

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

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

            </Condition>

            <Then>

              <If description="Is the application present? If not, we are running a fresh install. If it is, we will later check to see if it is running the latest version. ">

                <Condition name="CheckRegistryValue">

                  <Parameter xsi:type="StringParameter" name="RegistryPath" value="#regkey#" />

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

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

                </Condition>

                <Then>

                  <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                    <Parameter xsi:type="StringParameter" name="Comment" value="#appname# is already installed, detecting if update is needed." />

                  </Statement>

                  <Statement description="Look at the version of the application based on a registry key. " name="GetVariable" continueOnFail="false" osType="Windows">

                    <Parameter xsi:type="EnumParameter" name="VariableType" value="RegistryValue" />

                    <Parameter xsi:type="StringParameter" name="SourceContent" value="#regkey#" />

                    <Parameter xsi:type="StringParameter" name="VariableName" value="updateversion" />

                  </Statement>

                </Then>

                <Else>

                  <If description="">

                    <Condition name="CheckRegistryValue64">

                      <Parameter xsi:type="StringParameter" name="RegistryPath" value="#regkey#" />

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

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

                    </Condition>

                    <Then>

                      <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                        <Parameter xsi:type="StringParameter" name="Comment" value="#appname# is already installed, detecting if update is needed." />

                      </Statement>

                      <Statement description="Look at the version of the application based on a registry key. " name="GetVariable" continueOnFail="false" osType="Windows">

                        <Parameter xsi:type="EnumParameter" name="VariableType" value="RegistryValue64" />

                        <Parameter xsi:type="StringParameter" name="SourceContent" value="#regkey#" />

                        <Parameter xsi:type="StringParameter" name="VariableName" value="updateversion" />

                      </Statement>

                    </Then>

                    <Else>

                      <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                        <Parameter xsi:type="StringParameter" name="Comment" value="#regkey# not found." />

                      </Statement>

                      <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                        <Parameter xsi:type="StringParameter" name="Comment" value="#appname# not present. Installing for the first time." />

                      </Statement>

                      <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

                        <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

                        <Parameter xsi:type="StringParameter" name="SourceContent" value="newinstall" />

                        <Parameter xsi:type="StringParameter" name="VariableName" value="global:updateneeded" />

                      </Statement>

                      <If description="This is the integer in the registry after the application is installed.">

                        <Condition name="CheckVariable">

                          <Parameter xsi:type="StringParameter" name="VariableName" value="#updateversion#" />

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

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

                        </Condition>

                        <Then>

                          <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                            <Parameter xsi:type="StringParameter" name="Comment" value="#appname# installed but not at latest version, currently is #updateversion#. Update needed" />

                          </Statement>

                          <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

                            <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

                            <Parameter xsi:type="StringParameter" name="SourceContent" value="updateneeded" />

                            <Parameter xsi:type="StringParameter" name="VariableName" value="global:updateneeded" />

                          </Statement>

                        </Then>

                        <Else>

                          <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                            <Parameter xsi:type="StringParameter" name="Comment" value="#appname# appears to be up to date. Version is #updateversion#" />

                          </Statement>

                        </Else>

                      </If>

                    </Else>

                  </If>

                </Else>

              </If>

              <If description="">

                <Condition name="CheckVariable">

                  <Parameter xsi:type="StringParameter" name="VariableName" value="#global:updateneeded#" />

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

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

                </Condition>

                <Then>

                  <Statement description="Check for the existence of the 'officeinstall' folder and look at the total byte size and number of files. If it does not exist, the ELSE statements will download the office files from the designated file share and run this same check again. " name="ExecuteShellCommand" continueOnFail="false" osType="Windows">

                    <Parameter xsi:type="StringParameter" name="Command" value="dir &quot;#vagentconfiguration.agenttempdir#\#filename#&quot; &gt;&gt; &quot;#vagentconfiguration.agenttempdir#\dirlist-#appname#.txt&quot;" />

                    <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />

                    <Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />

                  </Statement>

                  <If description="Either the application file isn't present, or it is not the right byte size. Regardless, we will attempt to get the file again. ">

                    <Condition name="TestFile">

                      <Parameter xsi:type="StringParameter" name="Path" value="#vagentconfiguration.agenttempdir#\dirlist-#appname#.txt" />

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

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

                    </Condition>

                    <Then>

                      <Statement description="Delete the 'dirlist' file in the agent temporary folder - this is used as a simple variable later in the procedure." name="DeleteFile" continueOnFail="true" osType="Windows">

                        <Parameter xsi:type="StringParameter" name="Path" value="#vagentconfiguration.agenttempdir#\dirlist-#appname#.txt" />

                      </Statement>

                      <If description="If the user is logged in, give them a 30 second notice that the application will terminate. If the user is not logged in, terminate the application. ">

                        <Condition name="ApplicationRunning">

                          <Parameter xsi:type="StringParameter" name="ApplicationName" value="#appexe#" />

                        </Condition>

                        <Then>

                          <If description="">

                            <Condition name="UserIsLoggedIn">

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

                            </Condition>

                            <Then>

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

                                <Parameter xsi:type="StringParameter" name="Message" value="#appname# needs to be closed in order for an important update to be installed. It will automatically be closed in 30 seconds. " />

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

                              </Statement>

                              <Statement description="Pause this procedure for N seconds to give a previous action time to complete." name="PauseScript" continueOnFail="false" osType="Windows">

                                <Parameter xsi:type="IntegerParameter" name="Seconds" value="30" />

                              </Statement>

                              <Statement description="Close the specified application." name="CloseApplication" continueOnFail="true" osType="Windows">

                                <Parameter xsi:type="StringParameter" name="ApplicationName" value="#appexe#" />

                              </Statement>

                            </Then>

                            <Else>

                              <Statement description="Close the specified application." name="CloseApplication" continueOnFail="false" osType="Windows">

                                <Parameter xsi:type="StringParameter" name="ApplicationName" value="#appexe#" />

                              </Statement>

                            </Else>

                          </If>

                        </Then>

                      </If>

                      <Statement description="Close the specified application." name="CloseApplication" continueOnFail="true" osType="Windows">

                        <Parameter xsi:type="StringParameter" name="ApplicationName" value="#filename#" />

                      </Statement>

                      <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                        <Parameter xsi:type="StringParameter" name="Comment" value="Starting install procedure with command &quot;#vagentconfiguration.agenttempdir#\#filename#&quot; #installswitches# " />

                      </Statement>

                      <Statement description="This is an installation command. You may want to set it to 'continue on fail' if it is not critical that it executes (in some cases you may know the command can sometimes fail, so use a 'continue on fail' if it wont prevent the installation). " name="ExecuteShellCommand" continueOnFail="false" osType="Windows">

                        <Parameter xsi:type="StringParameter" name="Command" value="&quot;#vagentconfiguration.agenttempdir#\#filename#&quot; #installswitches#" />

                        <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />

                        <Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />

                      </Statement>

                      <If description="">

                        <Condition name="CheckRegistryValue64">

                          <Parameter xsi:type="StringParameter" name="RegistryPath" value="#regkey#" />

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

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

                        </Condition>

                        <Then>

                          <Statement description="Collect the version of the application to a variable" name="GetVariable" continueOnFail="false" osType="Windows">

                            <Parameter xsi:type="EnumParameter" name="VariableType" value="RegistryValue64" />

                            <Parameter xsi:type="StringParameter" name="SourceContent" value="#regkey#" />

                            <Parameter xsi:type="StringParameter" name="VariableName" value="global:version" />

                          </Statement>

                        </Then>

                      </If>

                      <If description="Check to see if our installation succeeded or not. If it did, we should have this registry key present on the system. ">

                        <Condition name="CheckRegistryValue">

                          <Parameter xsi:type="StringParameter" name="RegistryPath" value="#regkey#" />

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

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

                        </Condition>

                        <Then>

                          <Statement description="Collect the version of the application to a variable" name="GetVariable" continueOnFail="false" osType="Windows">

                            <Parameter xsi:type="EnumParameter" name="VariableType" value="RegistryValue" />

                            <Parameter xsi:type="StringParameter" name="SourceContent" value="#regkey#" />

                            <Parameter xsi:type="StringParameter" name="VariableName" value="global:version" />

                          </Statement>

                        </Then>

                      </If>

                      <If description="">

                        <Condition name="CheckVariable">

                          <Parameter xsi:type="StringParameter" name="VariableName" value="#global:version#" />

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

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

                        </Condition>

                        <Then>

                          <If description="If the version of the application in the registry is correct, we have installed successfully">

                            <Condition name="CheckVariable">

                              <Parameter xsi:type="StringParameter" name="VariableName" value="#global:version#" />

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

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

                            </Condition>

                            <Then>

                              <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                                <Parameter xsi:type="StringParameter" name="Comment" value="#appname# Installation completed, new version is #global:version#. " />

                              </Statement>

                              <Statement description="Deletes the installer once we have installed the application." name="DeleteFile" continueOnFail="true" osType="Windows">

                                <Parameter xsi:type="StringParameter" name="Path" value="#vagentconfiguration.agenttempdir#\#filename#" />

                              </Statement>

                              <Statement description="Set the specified registry value - Regedit displays keys as folders and values as documents." name="SetRegistryValue" continueOnFail="false" osType="Windows">

                                <Parameter xsi:type="StringParameter" name="RegistryPath" value="HKEY_LOCAL_MACHINE\Software\Kaseya\#appname#-installcount" />

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

                                <Parameter xsi:type="EnumParameter" name="DataType" value="String" />

                              </Statement>

                              <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

                                <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

                                <Parameter xsi:type="StringParameter" name="SourceContent" value="0" />

                                <Parameter xsi:type="StringParameter" name="VariableName" value="global:newinstallcount" />

                              </Statement>

                              <If description="">

                                <Condition name="TestFile">

                                  <Parameter xsi:type="StringParameter" name="Path" value="#vagentconfiguration.agenttempdir#\#app#-64bit-cmd.bat" />

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

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

                                </Condition>

                                <Then>

                                  <If description="">

                                    <Condition name="TestFile">

                                      <Parameter xsi:type="StringParameter" name="Path" value="#vagentconfiguration.agenttempdir#\#app#-64bit-cmd.bat" />

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

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

                                    </Condition>

                                    <Then>

                                      <If description="">

                                        <Condition name="CheckRegistryValue">

                                          <Parameter xsi:type="StringParameter" name="RegistryPath" value="HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0\Identifier" />

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

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

                                        </Condition>

                                        <Then>

                                          <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                                            <Parameter xsi:type="StringParameter" name="Comment" value="Executing Post-install commands for 64-bit OS." />

                                          </Statement>

                                          <Statement description="Execute the given command as if it were typed in at a command prompt." name="ExecuteShellCommand" continueOnFail="false" osType="Windows">

                                            <Parameter xsi:type="StringParameter" name="Command" value="#vagentconfiguration.agenttempdir#\#app#-64bit-cmd.bat" />

                                            <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />

                                            <Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />

                                          </Statement>

                                        </Then>

                                      </If>

                                    </Then>

                                  </If>

                                </Then>

                              </If>

                              <If description="">

                                <Condition name="TestFile">

                                  <Parameter xsi:type="StringParameter" name="Path" value="#vagentconfiguration.agenttempdir#\#app#-32bit-cmd.bat" />

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

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

                                </Condition>

                                <Then>

                                  <If description="">

                                    <Condition name="TestFile">

                                      <Parameter xsi:type="StringParameter" name="Path" value="#vagentconfiguration.agenttempdir#\#app#-32bit-cmd.bat" />

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

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

                                    </Condition>

                                    <Then>

                                      <If description="">

                                        <Condition name="CheckRegistryValue">

                                          <Parameter xsi:type="StringParameter" name="RegistryPath" value="HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0\Identifier" />

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

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

                                        </Condition>

                                        <Then>

                                          <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                                            <Parameter xsi:type="StringParameter" name="Comment" value="Executing Post-install commands for 32-bit OS." />

                                          </Statement>

                                          <Statement description="Execute the given command as if it were typed in at a command prompt." name="ExecuteShellCommand" continueOnFail="false" osType="Windows">

                                            <Parameter xsi:type="StringParameter" name="Command" value="#vagentconfiguration.agenttempdir#\#app#-32bit-cmd.bat" />

                                            <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />

                                            <Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />

                                          </Statement>

                                        </Then>

                                      </If>

                                    </Then>

                                  </If>

                                </Then>

                              </If>

                            </Then>

                            <Else>

                              <Statement description="The application appears to have already been present, but it was not correctly updated to the latest version. " name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                                <Parameter xsi:type="StringParameter" name="Comment" value="Error: #appname# is installed but did not appear to update to the latest version. Version is #global:version#" />

                              </Statement>

                            </Else>

                          </If>

                        </Then>

                        <Else>

                          <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                            <Parameter xsi:type="StringParameter" name="Comment" value="Error: #appname# Install failed. Check to be sure system has enough free space." />

                          </Statement>

                        </Else>

                      </If>

                    </Then>

                    <Else>

                      <If description="IF this variable is equal to 2, the system is configured to use a file share under Patch Management. We will tell the patch server to download the application file, then this procedure will attempt to copy it from the file share after 2 minutes, giving it ample time to download.">

                        <Condition name="CheckVariable">

                          <Parameter xsi:type="StringParameter" name="VariableName" value="#vpatchconfiguration.FileSourceSetting#" />

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

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

                        </Condition>

                        <Then>

                          <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                            <Parameter xsi:type="StringParameter" name="Comment" value="#appname# Installer not present. Copying files from file share." />

                          </Statement>

                          <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                            <Parameter xsi:type="StringParameter" name="Comment" value="Attempting to connect to file share..." />

                          </Statement>

                          <Statement description="Use the user logon credentials set for the machine ID to execute a file or shell command - Windows 2000 and above only." name="UseCredential" continueOnFail="false" osType="Windows" />

                          <Statement description="Execute the given command as if it were typed in at a command prompt." name="ExecuteShellCommand" continueOnFail="true" osType="Windows">

                            <Parameter xsi:type="StringParameter" name="Command" value="dir &quot;#vpatchconfiguration.FileSourceUNCPath##filename#&quot; &gt;&gt; &quot;#vagentconfiguration.agenttempdir#\#appname#-share.txt&quot;" />

                            <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="User" />

                            <Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />

                          </Statement>

                          <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="true" osType="Windows">

                            <Parameter xsi:type="EnumParameter" name="VariableType" value="FileContent" />

                            <Parameter xsi:type="StringParameter" name="SourceContent" value="#vagentconfiguration.agenttempdir#\#appname#-share.txt" />

                            <Parameter xsi:type="StringParameter" name="VariableName" value="connecttoshare" />

                          </Statement>

                          <Statement description="Delete the specified file - full path to the filename required." name="DeleteFile" continueOnFail="true" osType="Windows">

                            <Parameter xsi:type="StringParameter" name="Path" value="#vagentconfiguration.agenttempdir#\#appname#-share.txt" />

                          </Statement>

                          <If description="">

                            <Condition name="CheckVariable">

                              <Parameter xsi:type="StringParameter" name="VariableName" value="#connecttoshare#" />

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

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

                            </Condition>

                            <Then>

                              <If description="">

                                <Condition name="CheckVariable">

                                  <Parameter xsi:type="StringParameter" name="VariableName" value="#connecttoshare#" />

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

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

                                </Condition>

                                <Then>

                                  <If description="">

                                    <Condition name="CheckVariable">

                                      <Parameter xsi:type="StringParameter" name="VariableName" value="#connecttoshare#" />

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

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

                                    </Condition>

                                    <Then>

                                      <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                                        <Parameter xsi:type="StringParameter" name="Comment" value="Agent able to connect to file share and #filename# is present. Copying file..." />

                                      </Statement>

                                      <Statement description="Copy the application file to the agent." name="ExecuteShellCommand" continueOnFail="false" osType="Windows">

                                        <Parameter xsi:type="StringParameter" name="Command" value="xcopy /Y /H /E /I &quot;#vpatchconfiguration.FileSourceUNCPath##filename#&quot; &quot;#vagentconfiguration.agenttempdir#&quot;" />

                                        <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="User" />

                                        <Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />

                                      </Statement>

                                      <Statement description="Execute the given command as if it were typed in at a command prompt." name="ExecuteShellCommand" continueOnFail="false" osType="Windows">

                                        <Parameter xsi:type="StringParameter" name="Command" value="dir &quot;#vagentconfiguration.agenttempdir#\#filename#&quot; &gt;&gt; &quot;#vagentconfiguration.agenttempdir#\#appname#-copy.txt&quot;" />

                                        <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />

                                        <Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />

                                      </Statement>

                                      <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

                                        <Parameter xsi:type="EnumParameter" name="VariableType" value="FileContent" />

                                        <Parameter xsi:type="StringParameter" name="SourceContent" value="#vagentconfiguration.agenttempdir#\#appname#-copy.txt" />

                                        <Parameter xsi:type="StringParameter" name="VariableName" value="copyfile" />

                                      </Statement>

                                      <Statement description="Delete the specified file - full path to the filename required." name="DeleteFile" continueOnFail="true" osType="Windows">

                                        <Parameter xsi:type="StringParameter" name="Path" value="#vagentconfiguration.agenttempdir#\#appname#-copy.txt" />

                                      </Statement>

                                      <If description="">

                                        <Condition name="CheckVariable">

                                          <Parameter xsi:type="StringParameter" name="VariableName" value="#copyfile#" />

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

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

                                        </Condition>

                                        <Then>

                                          <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                                            <Parameter xsi:type="StringParameter" name="Comment" value="#filename# copied successfully! " />

                                          </Statement>

                                          <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

                                            <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

                                            <Parameter xsi:type="StringParameter" name="SourceContent" value="0" />

                                            <Parameter xsi:type="StringParameter" name="VariableName" value="global:reschedule" />

                                          </Statement>

                                        </Then>

                                        <Else>

                                          <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                                            <Parameter xsi:type="StringParameter" name="Comment" value="Share exists, #filename# is present, but unable to copy file from share. " />

                                          </Statement>

                                          <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

                                            <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

                                            <Parameter xsi:type="StringParameter" name="SourceContent" value="unabletoconnect" />

                                            <Parameter xsi:type="StringParameter" name="VariableName" value="global:unabletoconnect" />

                                          </Statement>

                                        </Else>

                                      </If>

                                    </Then>

                                    <Else>

                                      <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

                                        <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

                                        <Parameter xsi:type="StringParameter" name="SourceContent" value="0" />

                                        <Parameter xsi:type="StringParameter" name="VariableName" value="global:reschedulefilesource" />

                                      </Statement>

                                      <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

                                        <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

                                        <Parameter xsi:type="StringParameter" name="SourceContent" value="2" />

                                        <Parameter xsi:type="StringParameter" name="VariableName" value="global:reschedule" />

                                      </Statement>

                                    </Else>

                                  </If>

                                </Then>

                                <Else>

                                  <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                                    <Parameter xsi:type="StringParameter" name="Comment" value="Agent cannot communicate with file share #vpatchconfiguration.FileSourceUNCPath# on #vpatchconfiguration.FileSourceMachineId#" />

                                  </Statement>

                                  <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

                                    <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

                                    <Parameter xsi:type="StringParameter" name="SourceContent" value="unabletoconnect" />

                                    <Parameter xsi:type="StringParameter" name="VariableName" value="global:unabletoconnect" />

                                  </Statement>

                                </Else>

                              </If>

                            </Then>

                            <Else>

                              <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                                <Parameter xsi:type="StringParameter" name="Comment" value="Error: Unable to run shell command to check connectivity to file share. Verify Agent Credentials under Agent -- Set Credentials have Admin access to this agent. " />

                              </Statement>

                            </Else>

                          </If>

                          <If description="">

                            <Condition name="CheckVariable">

                              <Parameter xsi:type="StringParameter" name="VariableName" value="#global:unabletoconnect#" />

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

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

                            </Condition>

                            <Then>

                              <If description="">

                                <Condition name="CheckVariable">

                                  <Parameter xsi:type="StringParameter" name="VariableName" value="#vpatchconfiguration.UseInternetSourceAsFallback#" />

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

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

                                </Condition>

                                <Then>

                                  <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                                    <Parameter xsi:type="StringParameter" name="Comment" value="Internet Fallback is enabled. Proceeding with internet download..." />

                                  </Statement>

                                  <Statement description="Download the installer" name="GetURL" continueOnFail="false" osType="Windows">

                                    <Parameter xsi:type="StringParameter" name="URL" value="#downloadurl#" />

                                    <Parameter xsi:type="StringParameter" name="ResponseFileName" value="#vagentconfiguration.agenttempdir#\#filename#" />

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

                                  </Statement>

                                  <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

                                    <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

                                    <Parameter xsi:type="StringParameter" name="SourceContent" value="0" />

                                    <Parameter xsi:type="StringParameter" name="VariableName" value="global:reschedule" />

                                  </Statement>

                                </Then>

                                <Else>

                                  <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                                    <Parameter xsi:type="StringParameter" name="Comment" value="Error: Internet download is disabled and agent cannot communicate with file share. " />

                                  </Statement>

                                </Else>

                              </If>

                            </Then>

                          </If>

                        </Then>

                        <Else>

                          <If description="IF this variable is 0 or 1, the system is configured to  download files from the internet or Kaseya server. Using &quot;Write File&quot; does not work well with this kind of generic install procedure, so you will want to make the file available via HTTP from your Kaseya server.">

                            <Condition name="CheckVariable">

                              <Parameter xsi:type="StringParameter" name="VariableName" value="#vpatchconfiguration.FileSourceSetting#" />

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

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

                            </Condition>

                            <Then>

                              <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                                <Parameter xsi:type="StringParameter" name="Comment" value="#appname# Installer not present. Writing File from Kserver." />

                              </Statement>

                              <Statement description="Be sure to update this step with your intended file on the Kaseya server! " name="WriteFile" continueOnFail="false" osType="Windows">

                                <Parameter xsi:type="StringParameter" name="Path" value="#vagentconfiguration.agenttempdir#\#filename#" />

                                <Parameter xsi:type="StringParameter" name="ManagedFile" value="VSASharedFiles\install_flash_player.exe" />

                              </Statement>

                              <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

                                <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

                                <Parameter xsi:type="StringParameter" name="SourceContent" value="0" />

                                <Parameter xsi:type="StringParameter" name="VariableName" value="global:reschedule" />

                              </Statement>

                            </Then>

                            <Else>

                              <If description="IF this variable is 0 or 1, the system is configured to  download files from the internet or Kaseya server. Using &quot;Write File&quot; does not work well with this kind of generic install procedure, so you will want to make the file available via HTTP from your Kaseya server.">

                                <Condition name="CheckVariable">

                                  <Parameter xsi:type="StringParameter" name="VariableName" value="#vpatchconfiguration.FileSourceSetting#" />

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

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

                                </Condition>

                                <Then>

                                  <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                                    <Parameter xsi:type="StringParameter" name="Comment" value="#appname# Installer not present. Downloading from internet..." />

                                  </Statement>

                                  <Statement description="Download the installer" name="GetURL" continueOnFail="false" osType="Windows">

                                    <Parameter xsi:type="StringParameter" name="URL" value="#downloadurl#" />

                                    <Parameter xsi:type="StringParameter" name="ResponseFileName" value="#vagentconfiguration.agenttempdir#\#filename#" />

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

                                  </Statement>

                                  <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">

                                    <Parameter xsi:type="EnumParameter" name="VariableType" value="ConstantValue" />

                                    <Parameter xsi:type="StringParameter" name="SourceContent" value="0" />

                                    <Parameter xsi:type="StringParameter" name="VariableName" value="global:reschedule" />

                                  </Statement>

                                </Then>

                                <Else>

                                  <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                                    <Parameter xsi:type="StringParameter" name="Comment" value="Error: Unable to determine patch settings. Cannot proceed with #appname# distribution. " />

                                  </Statement>

                                </Else>

                              </If>

                            </Else>

                          </If>

                        </Else>

                      </If>

                    </Else>

                  </If>

                  <If description="">

                    <Condition name="CheckVariable">

                      <Parameter xsi:type="StringParameter" name="VariableName" value="#global:reschedulefilesource#" />

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

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

                    </Condition>

                    <Then>

                      <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                        <Parameter xsi:type="StringParameter" name="Comment" value="Scheduling #appname# download" />

                      </Statement>

                      <Statement description="Schedule a procedure to run on a specified machine." name="ScheduleScript" continueOnFail="false" osType="Windows">

                        <Parameter xsi:type="StringParameter" name="ScriptName" value="1579641267" />

                        <Parameter xsi:type="StringParameter" name="TimeDelay" value="0" />

                        <Parameter xsi:type="StringParameter" name="MachineID" value="#vpatchconfiguration.FileSourceMachineId#" />

                      </Statement>

                      <Statement description="Pause to give file source time to download." name="PauseScript" continueOnFail="false" osType="Windows">

                        <Parameter xsi:type="IntegerParameter" name="Seconds" value="60" />

                      </Statement>

                    </Then>

                  </If>

                  <If description="">

                    <Condition name="CheckVariable">

                      <Parameter xsi:type="StringParameter" name="VariableName" value="#global:reschedule#" />

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

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

                    </Condition>

                    <Then>

                      <Statement description="Schedule a procedure to run on a specified machine." name="ScheduleScript" continueOnFail="false" osType="Windows">

                        <Parameter xsi:type="StringParameter" name="TimeDelay" value="0" />

                        <Parameter xsi:type="StringParameter" name="MachineID" value="#vagentconfiguration.Machine_GroupID#" />

                      </Statement>

                    </Then>

                  </If>

                </Then>

                <Else>

                  <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                    <Parameter xsi:type="StringParameter" name="Comment" value="Update Not Needed" />

                  </Statement>

                </Else>

              </If>

            </Then>

            <Else>

              <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="Windows">

                <Parameter xsi:type="StringParameter" name="Comment" value="Error: Maximum installation attempts of #installcycles# reached. Cancelling scheduled procedure. Please review Procedure log. " />

              </Statement>

            </Else>

          </If>

        </Else>

      </If>

      <Statement description="Delete the specified file - full path to the filename required." name="DeleteFile" continueOnFail="true" osType="Windows">

        <Parameter xsi:type="StringParameter" name="Path" value="#vagentconfiguration.agenttempdir#\#app#-32bit-cmd.bat" />

      </Statement>

      <Statement description="Delete the specified file - full path to the filename required." name="DeleteFile" continueOnFail="true" osType="Windows">

        <Parameter xsi:type="StringParameter" name="Path" value="#vagentconfiguration.agenttempdir#\#app#-64bit-cmd.bat" />

      </Statement>

    </Body>

  </Procedure>

</ScriptExport>

 

 

 

 

 



[edited by: noclav at 11:06 AM (GMT -7) on 4-3-2011] having posting problems