You are here

PowerShell - Query Database Remotely

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"

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
1 + 4 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer