Why is the Evaluation Code Skipped When I Manually Run a Worklet?

Objective

To explain why the Evaluation Code is bypassed when a Worklet is executed manually in the Automox console, and to provide step-by-step methods for testing Evaluation Code logic.

Overview

When an administrator manually triggers a Worklet from the Device Details page or the Policies page (using Run Policy Now), Automox skips the Evaluation Code phase entirely and immediately executes the Remediation Code. This behavior is designed to allow instant, on-demand remediation when an administrator manually intervenes.

Evaluation Code vs. Remediation Execution Flow

Understanding how code phases execute during scheduled policy cycles versus manual triggers helps ensure your Worklets perform as intended:

Trigger TypeEvaluation Code StatusRemediation Code Status
Scheduled ExecutionExecutes first. Evaluates system compliance state via exit codes.Conditional. Executes only if the Evaluation Code returns exit code 1.
Manual ExecutionBypassed / Skipped.Executes immediately as an explicit administrator command.

Evaluation Exit Code Reference

  • Exit Code 0: Indicates the device is compliant. Remediation Code is skipped during scheduled runs.

  • Exit Code 1 (or non-zero): Indicates the device is non-compliant. Remediation Code is triggered during scheduled runs.

How to Test Evaluation Code Logic

To verify that your Evaluation Code operates correctly without waiting for a production scheduled run, use one of the two testing methods below.

Method 1: Near-Future Scheduled Execution (Recommended)

Test the Worklet in its standard end-to-end operational flow:

1.Assign Worklet to a Test Device Group:

Assign the Worklet policy to a designated test group or non-production endpoint.

2.Set a Scheduled Execution Time:

Configure the policy schedule to execute a few minutes into the future.

3.Review the Activity Log:

After the scheduled time passes, inspect the Activity Log in the Automox console to verify whether the Evaluation Code returned exit code 0 (Compliant) or 1 (Triggered Remediation).

Method 2: Create a Temporary Evaluation Test Worklet

If you need to view detailed Write-Output or console messages from your Evaluation Code during an on-demand manual test:

1.Create a Temporary Clone Worklet:

Clone your original Worklet policy and name it TEST - Evaluation Code Output.

2.Move Evaluation Script to Remediation Section:

Copy the code from your Evaluation Code block and paste it into the Remediation Code block.

3.Force Remediation Trigger:

Set the Evaluation Code block of the test Worklet to simply return exit code 1:

PowerShell

 
# Force evaluation failure so remediation runs on schedule if needed
exit 1

4.Add Output Statements for Log Inspection:

Replace or supplement exit statements with Write-Output (PowerShell) or echo (Bash/Zsh) commands to capture diagnostic data in log entries.

5.Run Manually and Check Logs:

Execute the test Worklet manually, then navigate to Console > Activity Log to review the detailed evaluation script output.

⚠️ Warning: Do not assign temporary test Worklets to production device groups. Always restore standard Evaluation and Remediation code blocks before deploying Worklets to production environments.

Was this article helpful?
0 out of 0 found this helpful