Server automation-Automation Plan

I’m having the batch file to stop and start service.So,i’m coverting this batch file into fixlet using Software distribution and the command for silent installation i’m providing is “/S”,but when i’m pushing this fixlet using Server automation it is able to deploy but it is not making any changes in the endpoint.

Below you can see the log file

2015_06_04 14:52:43.87
Action ID: 986
Command: “stopServer.bat” /s
’“C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData\actionsite__Download\setupCmdLine.bat”’ is not recognized as an internal or external command,
operable program or batch file.
The system cannot find the path specified.
2015_06_04 14:54:41.51
Action ID: 987
Command: “stopNode.bat” /s
’“C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData\actionsite__Download\setupCmdLine.bat”’ is not recognized as an internal or external command,
operable program or batch file.
The system cannot find the path specified.
2015_06_04 14:56:09.56
Action ID: 988
Command: “stopManager.bat” /s
’“C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData\actionsite__Download\setupCmdLine.bat”’ is not recognized as an internal or external command,
operable program or batch file.
The system cannot find the path specified.

Hi Manish,

Does “stopServer.bat” / “stopNode.bat” / “stopManager.bat” get written out as part of the fixlet?

To me it looks like the fixlet is looking for a *.bat file in the client directory, but maybe that file does not exist.

Hi paul

what i’m doing directly i’m converting that bat file to fixlet using software distribution.I’m not making any changes in the fixlet…would you like me to add something to that fixlet.

Please make me clear because I need to complete today EOD.Your help will be highly appreciated :smile:

Hi Manish,

Generally, you do something like this:

delete __createfile
delete stop.bat

createfile until END_STOP_BAT
<full contents  of the bat file goes here>
END_STOP_BAT

move __createfile stop.bat
waithidden stop.bat
delete stop.bat

What’s happening here:

  • You delete any potentially pre-existing “stop.bat” file
  • You then write out a new “stop.bat” file writing the contents of the batch file you want to execute
  • You then execute that “stop.bat” file
  • You delete the “stop.bat” file when you’re done.

See if that works.

Could you share the actual actionscript of your fixlet?

@strawgate:- for stopping the server we are using below fixlet

//**Begin Preparation Marker
// Download all specified files
begin prefetch block
add prefetch item name=D7F5F57CEE389B62C6E8B2D13565661D8A60C45C sha1=d7f5f57cee389b62c6e8b2d13565661d8a60c45c size=219 url=SWDProtocol://127.0.0.1:52311/uploads/D7F5F57CEE389B62C6E8B2D13565661D8A60C45C/stopServer.bat.bfswd sha256=b4bdbd7ba84064f1839a08cce72c775051b41e61f2550ef189d75e660c0c5190
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/D7F5F57CEE389B62C6E8B2D13565661D8A60C45C” “{parameter “baseFolder”}stopServer.bat”

// 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.
set DATESTAMP=%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%
set DATEANDTIME=%DATESTAMP% %time%
echo %DATEANDTIME% >> "{parameter “logFolder”}/{parameter “logFile”}"
echo Action ID: {id of active action} >> "{parameter “logFolder”}/{parameter “logFile”}"
rem //**Begin Command Marker
echo Command: “stopServer.bat” /s >> "{parameter “logFolder”}/{parameter “logFile”}"
set errorlevel=
“stopServer.bat” /s >> “{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

Thanks for your support Paul_curran. The above code really hepled me :smile:

No problem Manish - glad it was useful to you

1 Like