Author | Chrissy LeMaire (@cl), netnerds.net |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Test-DbaEndpoint on GitHub.
Want to see the Bill Of Health for this command? Check out Test-DbaEndpoint.
Tests network connectivity to SQL Server endpoint TCP listener ports.
Tests network connectivity to SQL Server endpoint TCP listener ports by attempting direct socket connections. This function validates that endpoint ports are accessible from the network level, which is essential for troubleshooting database mirroring, Service Broker, and availability group connectivity issues.
The function tests both standard TCP ports and SSL ports when configured, returning connection status rather than endpoint functionality. Endpoints without TCP listener ports (such as HTTP endpoints) are automatically skipped during testing.
Use this when diagnosing connectivity problems between SQL Server instances or validating firewall rules before setting up features that rely on endpoints.
Test-DbaEndpoint
[[-SqlInstance] <DbaInstanceParameter[]>]
[[-SqlCredential] <PSCredential>]
[[-Endpoint] <String[]>]
[[-InputObject] <Endpoint[]>]
[-EnableException]
[<CommonParameters>]
PS C:\> Test-DbaEndpoint -SqlInstance localhost
Tests all endpoints on the local default SQL Server instance.
Note that if an endpoint does not have a tcp listener port, it will be skipped.
PS C:\> Get-DbaEndpoint -SqlInstance localhost, sql2016 -Endpoint Mirror | Test-DbaEndpoint
Tests all endpoints named Mirroring on sql2016 and localhost.
Note that if an endpoint does not have a tcp listener port, it will be skipped.
PS C:\> Test-DbaEndpoint -SqlInstance localhost, sql2016 -Endpoint Mirror
Tests all endpoints named Mirroring on sql2016 and localhost.
Note that if an endpoint does not have a tcp listener port, it will be skipped.
PS C:\> Test-DbaEndpoint -SqlInstance localhost -Verbose
Tests all endpoints on the local default SQL Server instance.
See all endpoints that were skipped due to not having a tcp listener port.
The target SQL Server instance or instances.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Specifies which endpoint names to test for network connectivity. Accepts multiple endpoint names to filter testing to specific endpoints.
Use this when you need to validate connectivity for particular endpoints like database mirroring, Service Broker, or availability group listeners instead of testing all endpoints on the instance.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Accepts endpoint objects from Get-DbaEndpoint for pipeline processing. This allows you to filter endpoints first using Get-DbaEndpoint, then test only those specific endpoints.
Use this approach when you need to apply complex filtering logic before testing connectivity, such as testing only endpoints of a specific type or state.
Alias | |
Required | False |
Pipeline | true (ByValue) |
Default Value |
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |