How to get service broker database queue status? I need to get service broker queue status (Enabled/Disabled) somehow programmatically. Either, T-SQL, PowerShell, etc.
I tried $MyQueue = Get-ChildItem SQLSERVER:\SQL\mydbserver\default\databases\MyQueue\ServiceBroker\Queues | where {$_.Name -like "MyQueue"} but couldn’t find how to get the status.
Thanks in advance.
PoSh just wraps SMO. ServiceQueue exposes IsEnqueueEnabled for queue status, IsActivationEnabled for activation status,
IsRetentionEnabled for retention status and finally IsPoisonMessageHandlingEnabled for, well, poison message handling status.

Also PoSh has the habit of hiding properties. See how to see all properties.