The use of Write-Host and SQL Server Agent PowerShell job steps

SQL Server Agent implements a job subsystem that allows users to directly run PowerShell scripts in SQL Server Agent. Internally this is implemented by reusing the SQLPS.EXE shell stub (which is another shape of POWERSHELL.EXE, but preconfigured for SQL Server). When SQL Server Agent starts SQLPS.EXE, it does not do this through the console (there…