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"
write-output "pending reboot required"
write-output "no pending reboot required."
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