I am writing a script to iterate through numerous SQL scripts. These have been generated through a Redgate tool, and will basically migrate a database. There are several hundred of these.
I have written the basic script that iterates through them, and it works. I am using the Invoke-Command (with a ScriptBlock), since the scripts have already been generated.
However, there is a lot of output generated, all the SQL table drops etc, and I really only want to see any output if there has been a failure. In such a situation, I would like to stop execution. I guess I would us a try-catch method.
So, given the above, I am after any tips regarding verbosity and error-catching.
Note, I am doing the PluralSight course in PS, but it is a bit basic so far.