Guide
Microsoft
SQL
Query Microsoft SQL Server with PowerShell: SELECT, Parameters, Invoke-Sqlcmd and CSV Export
Run SELECT queries against Microsoft SQL Server from PowerShell with SqlClient or Invoke-Sqlcmd, pass parameters safely, use Windows or SQL logins, handle TLS and export results to CSV.