commands

^

Get-DbaDbServiceBrokerService

Author Ant Green (@ant_green)
Availability Windows, Linux, macOS

 

Want to see the source code for this command? Check out Get-DbaDbServiceBrokerService on GitHub.
Want to see the Bill Of Health for this command? Check out Get-DbaDbServiceBrokerService.

Synopsis

Retrieves Service Broker services from SQL Server databases for auditing and troubleshooting messaging configurations

Description

Retrieves detailed information about Service Broker services configured in SQL Server databases, including service names, associated queues, schemas, and ownership details. Service Broker services define the endpoints for reliable messaging between applications and databases. This function helps DBAs audit Service Broker implementations, troubleshoot message-based applications, and document messaging configurations for compliance or migration planning.

Syntax

Get-DbaDbServiceBrokerService
    [[-SqlInstance] <DbaInstanceParameter[]>]
    [[-SqlCredential] <PSCredential>]
    [[-Database] <Object[]>]
    [[-ExcludeDatabase] <Object[]>]
    [-ExcludeSystemService]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Get-DbaDbServiceBrokerService -SqlInstance sql2016

Gets all database service broker queues

Example: 2
PS C:\> Get-DbaDbServiceBrokerService -SqlInstance Server1 -Database db1

Gets the service broker queues for the db1 database

Example: 3
PS C:\> Get-DbaDbServiceBrokerService -SqlInstance Server1 -ExcludeDatabase db1

Gets the service broker queues for all databases except db1

Example: 4
PS C:\> Get-DbaDbServiceBrokerService -SqlInstance Server1 -ExcludeSystemService

Gets the service broker queues for all databases that are not system objects

Optional Parameters

-SqlInstance

The target SQL Server instance or instances

Alias
Required False
Pipeline true (ByValue)
Default Value
-SqlCredential

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
-Database

Specifies which databases to query for Service Broker services. Accepts multiple database names.
Use this when you need to limit the search to specific databases instead of scanning all databases on the instance.

Alias
Required False
Pipeline false
Default Value
-ExcludeDatabase

Excludes specific databases from the Service Broker service search. Accepts multiple database names.
Useful when you want to audit most databases but skip known databases without Service Broker configurations.

Alias
Required False
Pipeline false
Default Value
-ExcludeSystemService

Excludes system-created Service Broker services from the results, showing only user-defined services.
Use this to focus on custom messaging implementations and avoid clutter from built-in SQL Server services.

Alias
Required False
Pipeline false
Default Value False
-EnableException

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