How to connect to SQL Server using Powershell and the "invoke-sqlcmd" command. This is a short tutorial and example of a connection string you can use in Powershell to connect and execute a SQL statement all in one line of code.
https://www.dbtales.com