Invoke-SQLCmd considered harmful
I mentioned here that Invoke-SQLCmd (included in the SQLPS module for SQL Server) was susceptible to SQL-Injection attacks, but I haven’t demonstrated that or ever seen anyone show it. To do so, I’ll start with code out of the help for Invoke-SQLCmd. Here’s the code (taken from here) Notice that the parameters are encoded in a …