Kaseya Community

Unable to execute a DOS installer command using executeShellCommand or ExecuteFile but works at the command line

  • I am trying to run a setup.exe file with a bunch of switches but using executeShellCommand or ExecuteFile does work (nothing happens).

    Tried executing as System and User to no avail.

    If I run the same setup.exe complete with the switches it runs and installs correctly at the command prompt.

    Tried to warp this up in a batch file but this made no difference as it would not run either via VSA or command line.

    Here is a sample of the executable switch:-

    c:\temp\setup.exe /s /V”/qn INSTALLDIR=\”C:\BSX\APPLICS\” ACCEPTEULA=\”Yes\” HOSTNAME=\”XuberRS\” SADMPATH=\”/x/sadmlog\” USERNAME=\”Xuber User\” COMPANYNAME

    Any advice would be appreciated.

    [edited by: Chris Y at 2:54 AM (GMT -7) on Jul 6, 2020]
  • All the quotes and escaped quotes. I’ve had a few oddities in how they are handled. My debugging tip is to replace the setup command with echo or type and evaluate the output.

    I’ve been moving towards dropping PowerShell scripts and executing them rather than direct commands because of some of these oddities.
  • When you execute it from the command prompt, do you have to run it as Administrator, an Administrative user with network access or the current logged in user with raised permissions?

    The command that you put in your post I can see two issues that would cause the command to fail;

    1) The first set of quotes that starts after /V is incomplete, I would expect the first set to be closed after the company name but it is missing the closing quotes, see below I marked the 2,3,4,5 and 6 set of quotes;

    c:\temp\setup.exe /s /V"/qn INSTALLDIR=\"2" ACCEPTEULA=\"3" HOSTNAME=\"4" SADMPATH=\"5" USERNAME=\"6" COMPANYNAME

    2) the Quotes that you are using are the wrong kind, the double quotes are generated when you copy the example command from a website or an email.

    You want to use either single ' or double " and not ” copy this line to Notepad and you will see the difference. Using the wrong quotes in Agent Procedures will cause it to fail.

    Also are all to additional back slashers in front of the equal as signs required? See if the command will run without them from the command prompt. The setup.exe file appears to be a MSI wrapper, find out the publisher name of the setup file (eg: Installshield etc...).

  • Hardknox,

    After staring at this for the best part of a day, you have resolved my issue!

    The quotes I used were a straight lift off from the install guide written in Word.

    When I used the same layout on a copy and paste basis, it worked fine in a command line (Admin level) and I never thought twice about it until your comments.

    After substituting the original quotes with " ones, the installed worked.

    The setup file is indeed a MSI wrapper created using installshield.

    Thanks again for your help, I am very grateful.