Share via

Get-MSMQoutgoingQueue

Itamar Kasztelanski 66 Reputation points
2021-05-31T06:53:59.29+00:00

Hi,
I am running this command PS C:\> Get-MsmqOutgoingQueue -Name "Order*" | Clear-MsmqOutgoingQueue To clear Outgoing queue.
I want to clear only those queue that have a state MQ_QUEUE_STATE_NONACTIVE or MQ_QUEUE_STATE_WAITING.
The output of Get-MsmqOutgoingQueue is:
DestinationQueueFormatName : DIRECT=OS:Maasw53.cloudsfer.com\private$\MaaS.Backend.Planner.3
MessageCount : 5
BytesInQueue : 12700
UnacknowledgedMessageCount : 0
UnprocessedMessageCount : 0
ConnectionHost : maasw51
NextHops :
Transactional : MQ_XACT_STATUS_UNKNOWN
Foreign : STATUS_UNKNOWN
EodFirstNonAck : System.__ComObject
EodLastNonAck : SeqID: 6963899006397186076 SeqNo: 0 PrevNo: 0
EodLastAck : SeqID: 6963899006397186076 SeqNo: 8909 PrevNo: 0
EodNextSeq : SeqID: 6963899006397186076 SeqNo: 8915 PrevNo: 8914
EodLastAckCount : 1
EodLastAckTime :
EodNoAckCount : 0
EodNoReadCount : 0
EodResendCount : 1
EodResendInterval : 30000
EodResendTime :
State : MQ_QUEUE_STATE_NONACTIVE
Who do I modify the script?

Thanks

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments

Answer accepted by question author

Anonymous
2021-05-31T07:56:44.277+00:00

Hi,

You could try filtering by the state property using Where-Object.

Get-MsmqOutgoingQueue -Name "Order*" | Where-Object {($_.State -eq "MQ_QUEUE_STATE_NONACTIVE") -or ($_.State -eq "MQ_QUEUE_STATE_WAITING")} | Clear-MsmqOutgoingQueue   

Best Regards,
Ian Xue

============================================

If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.