AutomoxAutomox

write-output in worklet eval section doesn't show up in activity log

stevewar
September 28, 2022 at 7:33 pm UTC
#Worklets#powershell

I have some very basic code in the eval section of a worklet, as well as the remediation section. The output from the remediation sections shows up in the activity log, but the eval output does not. What am I doing wrong?

 

$sysInfo = New-Object -ComObject "Microsoft.Update.SystemInfo"
if($sysInfo.RebootRequired)
{ 
    write-output "pending reboot required"
    exit 1
}
else
{
    write-output "no pending reboot required."
    exit 0
}

 

 

This discussion is archived and closed to replies. Continue it in the Automox Community Slack.

Discuss on Slack

Replies (1)

KyleG-AutomoxSeptember 29, 2022
#1

Hey Steve,

Evaluation code isn’t reported back to the Activity Log, only Remediation Code is. This is because Evaluation code only cares about the exit codes and doesn’t rely or depend on any other actions. You have your exit codes correct however, as an exit 1 will move on the Remediation code for a reboot, while the exit 0 will stop there and mark the device as compliant.

 

More information on Worklets can be found below

https://help.automox.com/hc/en-us/articles/5352119754260-About-Worklets

 

Thank you.