Action on fixlet reports failed action even though everything was performed OK

I created a fixlet. When I create an action on it, the action is performed on the server, every line is executed as it should be, exit code of action is 0, relevance of the fixlet is changed from true to false, but still the action reports as failed. Any idea why? Here’s the action script:

action uses wow64 redirection false
// Stop service
waithidden cmd.exe /c net stop “healthservice”
// Rename folder on servers where SCOM is located in “System center Operations Manager” folder
if {exists folder “C:\Program Files\System Center Operations Manager\Agent”}
folder delete "C:\Program Files\System Center Operations Manager\Agent\Health Service State_old"
move “C:\Program Files\System Center Operations Manager\Agent\Health Service State” "C:\Program Files\System Center Operations Manager\Agent\Health Service State_old"
endif
// Rename folder on servers where SCOM is located in “Microsoft Monitoring Agent” folder
if {exists folder “C:\Program Files\Microsoft Monitoring Agent\Agent”}
folder delete "C:\Program Files\Microsoft Monitoring Agent\Agent\Health Service State_old"
move “C:\Program Files\Microsoft Monitoring Agent\Agent\Health Service State” "C:\Program Files\Microsoft Monitoring Agent\Agent\Health Service State_old"
endif
// Start the service
waithidden cmd.exe /c net start “healthservice”

Here is portion of log related to the action:
At 15:33:47 +0800 -
GatherHashMV command received.
At 15:33:48 +0800 - mailboxsite (htt//BFserver:52311/cgi-bin/bfgather.exe/mailboxsite4067203)
Downloaded ‘htt://10.176.164.9:52311/mailbox/files/14/55/1455d0c0f69b5a41bd32ca5ed0d9bb03b2586e8a’ as 'Action 115690.fxf’
Gather::SyncSiteByFile adding files - count: 1
At 15:33:48 +0800 -
Successful Synchronization with site ‘mailboxsite’ (version 106) - 'htt//BFserver:52311/cgi-bin/bfgather.exe/mailboxsite4067203’
Processing action site.
At 15:33:49 +0800 - mailboxsite (htt//BFserver:52311/cgi-bin/bfgather.exe/mailboxsite4067203)
Relevant - Flush agent (fixlet:115690)
At 15:33:50 +0800 -
ActionLogMessage: (action:115690) Action signature verified for Execution
ActionLogMessage: (action:115690) starting action
At 15:33:51 +0800 - actionsite (htt//BFserver:52311/cgi-bin/bfgather.exe/actionsite)
Wow64 redirection disabled. action uses wow64 redirection false (action:115690)
Command started - waithidden cmd.exe /c net stop “healthservice” (action:115690)
At 15:33:53 +0800 - actionsite (htt//BFserver:52311/cgi-bin/bfgather.exe/actionsite)
Command succeeded (Exit Code=0) waithidden cmd.exe /c net stop “healthservice” (action:115690)
At 15:33:54 +0800 - actionsite (htt//BFserver:52311/cgi-bin/bfgather.exe/actionsite)
Command succeeded folder delete “C:\Program Files\Microsoft Monitoring Agent\Agent\Health Service State_old” (action:115690)
At 15:33:55 +0800 - actionsite (htt//BFserver:52311/cgi-bin/bfgather.exe/actionsite)
Command succeeded move “C:\Program Files\Microsoft Monitoring Agent\Agent\Health Service State” “C:\Program Files\Microsoft Monitoring Agent\Agent\Health Service State_old” (action:115690)
Command started - waithidden cmd.exe /c net start “healthservice” (action:115690)
At 15:33:57 +0800 - actionsite (htt//BFserver:52311/cgi-bin/bfgather.exe/actionsite)
Command succeeded (Exit Code=0) waithidden cmd.exe /c net start “healthservice” (action:115690)
At 15:33:57 +0800 -
ActionLogMessage: (action:115690) ending action
At 15:33:57 +0800 - mailboxsite (htt//BFserver:52311/cgi-bin/bfgather.exe/mailboxsite4067203)
Not Relevant - Flush agent (fixlet:115690)

What does the Relevance for the fixlet look like?

What is your success criteria set to?

There are two conditions:

  1. (NOT (exists folder “C:\Program Files\System Center Operations Manager\Agent\Health Service State_old” whose (now - modification time of it < 30minute))) OR (NOT exists folder “C:\Program Files\Microsoft Monitoring Agent\Agent\Health Service State_old” whose (now - modification time of it < 30minute))
  2. exists running service “healthservice”

BigFix is set to report every 15 minutes. Since I’m not a MO, I can’t change that.

Success criteria are set “This action will be considered successful when the applicability relevance evaluates to false.”

Ok so you’re trying to restart the service every 30 minutes?

Change the success criteria to “All lines of the script execute successfully”. Otherwise, the action may show “Fixed” until the 30 minutes pass, and then switch to “Failed” when the 30 minutes are up and it becomes relevant again. In the Action Settings, set it to “Reapply while relevant, waiting 30 minutes between reapplications”.

The Bigfix Client, being a 32-bit application, gets redirectes to the 32-bit folders. When you try to query the “Program Files” folder, the operating system redirects to “Program Files (x86)”. Use the native program files folder inspector to use the real Program Files folder. Here’s one of your clauses as an example

NOT exists (folder “Microsoft Monitoring Agent\Agent\Health Service State_old” of native program files folder) whose (now - modification time of it < 30minute)

But actually, after changing the success criteria, the only relevance you should need is to check that the service exists and is running

exists running service whose (service name of it as lowercase = "healthservice")

I don’t want to restart the service every 30 minutes. I just need to be able to use the fixlet again after some time. But maybe once daily could be enough, usually we don’t do this operation more frequently than that. If I set success criteria to “all lines execute successfully”, and for example the service will hang on “starting” status, will the action be evaluated as successful? That could be a problem, that’s why I let the criteria as default, to be sure the service is running again.

In that case, in the Action Script after starting the service, add a line

continue if {exists running services whose (service name of it as lowercase = "healthservice"

If the service is not running at the end of the script, this line will evaluate as false and show a Failed result in the action.

For that you should also set the relevance to

exists services whose (service name of it as lowercase = "healthservice")

This way the Task will be relevant on machines where the service is present, but not running - allowing you to retry the action in case of a failure.