Custom Baseline issue

Hi everyone,

I’m beginner of BigFix, and have a quick question on Bigfix scripting.
I already had a custom baseline with three components which are doing following tasks.
My issue is after deployed this baseline to a client machine, baseline only able to stop BESclient service, but delete folder and start BESclient service is failed.
Does the baseline with something wrong? or any good ideas to achieve my purpose? thanks!

Component sequences
Componet 1. Stop BESClient Service
Componet 2. Delete folder "C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData"
Componet 3. Start BESClient Service

Component 1 action details:
delete __appendfile
appendfile @echo off
appendfile echo Your administrator is restarting the BES Client… Please Wait…
appendfile net stop BESClient
delete clientstop.bat
copy __appendfile clientstop.bat
run clientstop.bat

Component 2 action details:
folder delete “c:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData

Component 3 action details:
delete __appendfile
appendfile @echo off
appendfile echo Your administrator is restarting the BES Client… Please Wait…
appendfile net start BESClient
delete clientstart.bat
copy __appendfile clientstart.bat
run clientstart.bat

BESClient is the component that runs baselines (and their components).
After your component 1 stops BESClient, there are no one on your computer to run component 2 and 3.

In your case, I think you should create one batch file that does stop, delete and then start and run that batch file.

1 Like

Hi Akira,

Thanks for your reply first, and I follow your suggestion to create batch file to does stop,delete and then start. But i found a problem on “delete”, if i delete a folder like “C:\123” rather than “__BESData”, the whole actions of batch file is working. In turn if I specify to delete folder of “__BESData”, action will stuck on start BESClient Service.
I assume that client do not know what action to perform after delete the folder of “__BESData”… how to avoid this situation, any idea?

1 Like

Ah, I have forgotten to mention one important thing.
When you do appendfile or createfile, file is created under __BESData and the copy without path creates copied file under __BESData.
I think your batch file is lost when you delete __BESData. In your case, you need to move or copy your batch file to somewhere outside of __BESData and then run from there.

1 Like

What is your reason for wanting to delete this folder?

Hi Akira,

I followed your suggestion, copy the appendfile to other location and run the append file batch file, all actions in the bat file working fine, but new issue is showing up, the new issue is actions will keep unlimited looping to do stop,delete,start…I assumed that client unable report server the return code showing the action is completed or not… so when once the BESClient restart, client will receive “Relevant” message for the action … so that is the reason why client keep looping to do the action… I know that reason… but how to avoid it … any idea? thanks

Action script:
delete __appendfile
appendfile @echo off
appendfile echo Your administrator is restarting the BES Client… Please Wait…
appendfile net stop BESClient
appendfile rmdir /S /Q "C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData"
appendfile net start BESClient
appendfile exit /B
delete C:\Users\Public\clientRestart.bat
copy __appendfile C:\Users\Public\clientRestart.bat
run C:\Users\Public\clientRestart.bat

Hi Trn,

Our most of BES Clients are exactly encountering this issue as below:

It is rather difficult for the program to delete a folder it is actively using.

You would need to make a single action that used a script that stopped the client, then delete the folder, then start the client

What you are doing is running something that shuts the client down and then the client of course can do nothing else. It cannot run the second element in the baseline as it is shut down.

Is the action set to reapply? that would cause it to run multiple times.

You could add some sort of check in the bat file to have it only run once.

Actually deleting __BESData can cause any action still around to run again as the client has literally lost its memory :slight_smile:

1 Like

I did wonder about that.

Could write relevance that causes it to only run if a file does not exist and create that file with the BAT file that runs. This should keep it from reapplying.

You could also check the creation date of __BESData and if it was newer than the action date then don’t do it for this case.

When you run Fixlet, resulting action does not repeat unless you explicitly request because BigFix Agent “remembers” the one has already executed. But as AlanM mentioned, __BESData is the memory of BigFix Agent and by deleting __BESData, you erased all memory.
When BigFix Agent is started after deleting __BESSData, BigFix Agent has no memory of previously performed actions. So, when started, the Agent sees there is an action for the Agent to execute and runs. And the action stops Agent, erases memory, and then starts Agent. When started, Agent sees there is an action…, until the Action expires.

To avoid looping, the relevance of your Fixlet must become false when BigFix Agent starts after deleting __BESData.
As AlanM suggests, you can check creation time of __BESData, or you can check existence of your bat file outside of __BESData.