0

Can someone please help me understand why the second Invoke-SqlCmd doesn't log anything even though it encounters an error? I am using PowerShell.

What can be done to overcome this?

Log file:

enter image description here

  1. (Invoke-Sqlcmd -Query "PRINT 'Hello World!';" -ServerInstance $Server -verbose) 4>> 'C:\Users\Username\Execute Config\MyResultFile.txt'

    No Errors

  2. (Invoke-Sqlcmd -InputFile 'C:\Users\Username\Execute Config\ABC.sql' -ServerInstance $Serve -verbose) 4>> 'C:\Users\Username\MyResultFile.txt'

    Error:

    Error from second line of code

0 Answers0