PowerShell – Query Database Remotely Writer #1, 2016-03-18 The basic syntax for sending a query to SQL Server using PowerShell. sqlcmd -S SERVER_NAME -d master -Q "select count(1) from sys.objects" Powershell SQL Server databasepowershellsql query