How to send a resultcode from a macro to Windows-Scheduler

I start a macro with Windows-Scheduler. How can I give back a resultcode to the scheduler when the macro is finished?

From scheduler, call a tiny script (e. g. Batch or Powershell) that does the actual UI.Vision start. => The script can then check that everything has run OK and set the exit code accordingly.

For example, Windows task scheduler can call this RPA Powershell script. You only need to change the macro name and download folder to your settings, and you are all set. You can use this script without further changes.