New Software Distribution (Lifecycle)

I have a Software Deploy package built to install the Qualys agent on servers in the DMZ.
The package runs but starts in an evaluation state for a long time then to a running state and sits there. The file is copied down to the server. I have installed the software on a server using the same commands from the cmd prompt and it installs without and issue. The action script that runs is rather large but to break it down what what it is going to do is as follows:

// ---------------------------------------------EDITING INSTRUCTIONS---------------------------------------------------------------------
// When editing this task through the Manage Software Distribution Packages dashboard, you will have the option to preserve any custom edits you make to this action.
// If you select the option to preserve custom edits, only areas bound by the comment markers ‘Preparation Marker’, ‘Command Marker’ and ‘Closing Marker’ are updated.
// To ensure that all your custom Action Script changes can be preserved, only make changes to areas that are not bound by the comment markers.
// Removing the comment markers may result in the Action Script not updating correctly during the next edit.
// See KB Article swg21668807 (https://hclpnpsupport.service-now.com/csm?id=kb_article&sysparm_article=KB0023414) for more information.
// --------------------------------------------------------------------------------------------------------------------------------------

//**Begin Preparation Marker
// Download all specified files
begin prefetch block
add prefetch item name=3890faaa98fa80502c3690e78ca8416a3c1746c8 sha1=3890faaa98fa80502c3690e78ca8416a3c1746c8 size=22246464 url=SWDProtocol://127.0.0.1:52311/Uploads/3890faaa98fa80502c3690e78ca8416a3c1746c8/QualysCloudAgent.exe.bfswd sha256=85226b4faeed4fd8046ce40dbbd775702b37567b04ae5239f15c2cac1098ff6d
end prefetch block

// All SWD files will go into a folder in the clients __BESData folder. This folder gets cleared on every restart.
parameter “baseFolder” = “__Download/”
// Move files into subfolders and unescape file names
move “__Download/3890faaa98fa80502c3690e78ca8416a3c1746c8” “{parameter “baseFolder”}QualysCloudAgent.exe”

// Log setup
parameter “mainSWDLogFolder” = "{parent folder of client folder of current site}/__Global/SWDDeployData"
folder create "{parameter “mainSWDLogFolder”}"
parameter “logFile” = “SWD_DeploymentResults.log”

//**End Preparation Marker
delete __createfile
parameter “logFolder” = “{parameter “mainSWDLogFolder”}”
// Run setup process
delete run.bat

// Use .bat to set working directory to packages root, for setup command.
createfile until end
@ECHO OFF
cd "{parameter “baseFolder”}"
rem // See comments at the beginning of this action for an explanation of the comment markers.
echo %DATE% %TIME% >> "{parameter “logFolder”}{parameter “logFile”}"
echo Action ID: {id of active action} >> "{parameter “logFolder”}{parameter “logFile”}"
rem //**Begin Command Marker
echo Command: QualysCloudAgent.exe CustomerId={#############} ActivationId={########} WebServiceUri=https://qagpublic.qg2.apps.qualys.com/CloudAgent/ >> "{parameter “logFolder”}{parameter “logFile”}"
set errorlevel=
QualysCloudAgent.exe CustomerId={########} ActivationId={########} WebServiceUri=https://qagpublic.qg2.apps.qualys.com/CloudAgent/ >> “{parameter “logFolder”}{parameter “logFile”}” 2>&1
set SWDExitCode=%errorlevel%
rem //**End Command Marker

echo Return code: %SWDExitCode% >> "{parameter “logFolder”}{parameter “logFile”}"
echo. >> "{parameter “logFolder”}{parameter “logFile”}"
exit %SWDExitCode%
end

move __createfile run.bat
// You will not be able to stop or take action on an applicable BigFix Client until your installer completes.
// So ensure no user input is required.
// If your package absolutely must interact with the user, replace ‘override wait’ with ‘override run’ and ‘wait’ with ‘run’.
override wait
hidden=true
completion=job
wait run.bat

//**Begin Closing Marker
// Get the return code of the previous action.
parameter “returnCode” = “{exit code of action}”

// Task will now exit.
exit {parameter “returnCode”}
//**End Closing Marker

You have to escape the first { in your install command with another { for each set of curly brackets:

QualysCloudAgent.exe CustomerId={{########} ActivationId={{########} WebServiceUri=https://qagpublic.qg2.apps.qualys.com/CloudAgent/ >> “{parameter “logFolder”}{parameter “logFile”}” 2>&1

3 Likes

I have tried the “QualysCloudAgent.exe” with the double quotes around it, without the quotes and I will still end up with at failing installations.

I did not realize that I needed to put the additional curly bracket in the command line. That did the trick!

1 Like