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


This command is intended to help measure SQL Server network latency by establishing a connection and making a simple query. This is a better alternative than ping because it actually creates the connection to the SQL Server, and times not only the entire routine, but also how long the actual queries take vs how long it takes to get the results.




To time the execution of “SELECT TOP 100 * FROM sys.objects” 3 times on sqlserver2014a, using Windows Authentication to log into the server.


To time the execution results return of “select top 10 * from otherdb.dbo.table” 10 times on sqlserver2014a, sqlcluster, and sqlserver



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

Source Code

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

Related commands