dbatools is a free PowerShell module with over 300 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Test-DbaConnection

Tests the ability to connect to an SQL Server instance outputting information about the server and instance.

Screenshots

Examples

Test-DbaConnection SQL2016

Tests the SQL and Windows connections to SQL2016 using Windows Authentication

Test-DbaConnection -SqlInstance sql2016:2433 -SqlCredential (Get-Credential sqladmin)

Tests the SQL and Windows connections to SQL2016 on port 2433 using SQL Authentication

Test-DbaConnection -SqlInstance ‘sql2017,1433’ -Credential (Get-Credential base\sqlserver) -SqlCredential (Get-Credential sqladmin)

Tests the SQL and Windows connections to SQL2016 on port 2433 using alternative Windows Authentication for the SQL Server and alternative Windows credentials for the windows tests

Author

This command was created by Chrissy LeMaire. You can find Chrissy on Twitter.

Get-Help

From PowerShell, execute Get-Help Test-DbaConnection -Detailed for more information on this function.

Source Code

Want to see the source code? View Test-DbaConnection.ps1 on GitHub
 

Related commands