Lets say we have multiple invoke-sqlcmd statements like below:
invoke-sqlcmd -Query "PRINT 'Hello World 1'" -ServerInstance Server\SQL2017 -Database abc -Verbose
invoke-sqlcmd -Query "PRINT 'Hello World 2'" -ServerInstance Server\SQL2017 -Database abc -Verbose
invoke-sqlcmd -Query "PRINT 'Hello World 3'" -ServerInstance Server\SQL2017 -Database abc -Verbose
I want to do the following things:
- I want to log verbose output statements of multiple invoke-sqlcmd commands into a single log file
- Along with logging into the log file, can we show the verbose output in powershell window too? Also, can we manage it through any flag to show the output in powershell window or not?
Please suggest if it's possible or not.