Kaseya Community

Running a batch file in an agent procedure

  • I am trying to run an application install silently from Kaseya with an agent procedure. The batch file I create to run the install works when I run in manually from a workstation, but if I use this agent procedure to try and execute it, all it does is downloads the files and never executes the install.

    <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="Shortel Communicator Installation (EXE)" treePres="3" id="1145551453" folderId="963859313057669" treeFullPath="UGIES Scripts">
    <Body description="">
    <Statement name="WriteFile" continueOnFail="false" osType="Windows">
    <Parameter xsi:type="StringParameter" name="Path" value="c:\temp\setup.exe"/>
    <Parameter xsi:type="StringParameter" name="ManagedFile" value="VSASharedFiles\Shortel Communicator\setup.exe"/>
    <Parameter xsi:type="BooleanParameter" name="DeleteAfter" value="False"/>
    </Statement>
    <Statement name="WriteFile" continueOnFail="false" osType="Windows">
    <Parameter xsi:type="StringParameter" name="Path" value="c:\temp\shoretel.cmd"/>
    <Parameter xsi:type="StringParameter" name="ManagedFile" value="VSASharedFiles\Shortel Communicator\Shoretel.cmd"/>
    <Parameter xsi:type="BooleanParameter" name="DeleteAfter" value="False"/>
    </Statement>
    <Statement name="ImpersonateUser" continueOnFail="false" osType="Windows">
    <Parameter xsi:type="StringParameter" name="UserName" value="administrator"/>
    <Parameter xsi:type="StringParameter" name="Password" value="CoveredPwd2::0af1bf1e0bb58d39"/>
    <Parameter xsi:type="StringParameter" name="Domain" value=""/>
    </Statement>
    <Statement name="ExecuteShellCommand" continueOnFail="false" osType="Windows">
    <Parameter xsi:type="StringParameter" name="Command" value="cmd.exe /C c:\temp\shortel.cmd"/>
    <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="User"/>
    <Parameter xsi:type="BooleanParameter" name="Is64Bit" value="True"/>
    </Statement>
    </Body>
    </Procedure>
    </ScriptExport>
  • Could be UAC, the Batch file executes as 64bit User which means it won't run on 32bit machines. Can you share the Batch file too?

  • I have UAC turned off. This is all that the batch file does.

    c:\temp\setup.exe /S /v"/qn REBOOT=reallysuppress"

  • You don't need the Batch file then. Try the ExecuteFile command

    and if that does not work try ExecuteShellCommand, also try both option with Execute as System and Execute as User. Make sure that you add the useCredentials line before the ExecuteFile/ExecuteShellCommand if you try it with Execute as User option.