Invoke-SQLCommand, Verbose logging — solution: Start-Transcript / Stop-Transcript

Recently I needed to log the output of the Invoke-SQLCommand cmdlet including print statements.  I did some digging and some people said that Verbose output cannot be logged in PowerShell v2.  This is true, however – you CAN use Start-Transcript / Stop-Transcript and it will log everything that is in the PowerShell session…

WIN!

Start-Transcript -path “deploy_db_transcript_$currentTimePrefix.txt”

.. power shell stuff ..

stop-transcript

 

Reference: http://technet.microsoft.com/en-us/magazine/ff687007.aspx

 

Leave a Reply

Your email address will not be published. Required fields are marked *