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…

0

PowerShell Tips & Tricks: Getting more detailed error information from PowerShell

Allen White wrote this handy blogpost on how to handle error message and get more information out of an error record: http://sqlblog.com/blogs/allen_white/archive/2009/06/08/handling-errors-in-powershell.aspx There is an addtional method to get more information available. I found myself sending this little code snippet in email to many, and almost always I get the response that it saved that…

0