Is it possible to pass a standard ado connection string to Invoke-SqlCmd

Actually, Yes.

As of this writing the invoke-sqlcmd available in the SQLServer module includes a -connectionString parameter.


At the time this question was asked, no. More recently, yes, Invoke-Sqlcmd now supports a -ConnectionString parameter that accepts a standard database connection string as a value.

Previously, you'd need to break out each of the parameters in your connection string and match them up with the parameters that Invoke-Sqlcmd accepts.

If you had the flexibility and are stuck with a frozen legacy environment, you may wish to bodge Chad Miller's Invoke Sqlcmd2 and make it accept an ADO.NET connection string as one of its parameters:

https://gallery.technet.microsoft.com/scriptcenter/7985b7ef-ed89-4dfd-b02a-433cc4e30894