SQL query in PowerShell By Vampire | March 22, 2019 - 10:46 am |March 22, 2019 Code snippets, PowerShell, SQL $sql = "SELECT * FROM SQL_TABLE" $tbl = Invoke-Sqlcmd -ServerInstance "localhost" -Database "my_db" -Query $sql Write-Host $tbl.Count Bookmark the permalink.