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 returns the transport protocol and authentication scheme of the connection. This is useful to determine if your connection is using Kerberos. By default, the ConnectName, ServerName, Transport and AuthScheme of the current connection will be returned.

ConnectName is the name you used to connect. ServerName is the name that the SQL Server reports as its @@SERVERNAME which is used to register its SPN. If you were expecting a Kerberos connection and got NTLM instead, ensure ConnectName and ServerName match.

If -Kerberos or -Ntlm is specified, the $true/$false results of the test will be returned. Returns $true or $false by default for one server. Returns Server name and Results for more than one server.




To return ConnectName, ServerName, Transport and AuthScheme for sqlserver2014a and sql2016.

Test-DbaConnectionAuthScheme -SqlServer sqlserver2014a, sql2016

To return $true or $false depending on if the connection is Kerberos or not.

Test-DbaConnectionAuthScheme -SqlServer sqlserver2014a -Kerberos

To return the results of “SELECT * from sys.dm_exec_connections WHERE session_id = @@SPID”

Test-DbaConnectionAuthScheme -SqlServer sqlserver2014a -Detailed


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

Source Code

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

Related commands