IntuneManagement
IntuneManagement copied to clipboard
ErrorAction and Errorlist
Hey there, in non-interactive mode (-silent parameter), a wonderful and informative log is generated. However, setting the -ErrorAction parameter to "Stop" does not result in script termination. Perhaps you may not want the script to abort on every error, but only on errors related to the Graph API. Is there a planned approach for handling errors? Alternatively, a deterministic return value indicating whether errors occurred could also suffice. This would be very helpful.
Hope you can help :-)
Hello,
This is by design. Errors are either silenced by try/catch or SilentlyContinue.
However, they are normally sent to the Write-Log function as errors so you could add an exit there if an error occurred.
I have the opposite option in Settings eg log errors as warnings to not stop automation that would look at script errors. I could in theory add an option to exit if an error occurs but there are some "acceptable" errors so this might kill the script even if it is working.
Cheers!