Stuart Moore shows us how we can get a SQL Agent job running a Powershell step to recognize failure:
You might want the same response to make sure your monitoring is letting you know when jobs fail. On that note, it would also be nice if you could raise an error or failure message in your PowerShell step and have that propagate back up to SQL Server
Unfortunately the usual scripting standbys of returning 0 or $false don’t work.
Stuart does have a solution, though, so read on to learn what it is.