Quantcast
Channel: THWACK: All Content - Server & Application Monitor
Viewing all articles
Browse latest Browse all 12281

How do I add an "IF EXISTS" component to a WMI query of an MSMQ queue?

$
0
0

I have a WMI query of an MSMQ queue that works fine as long as there are messages in the queue:

Select MessagesInQueue From Win32_PerfRawData_msmq_MSMQQueue where Name="os:servername\\private$\\queuename")

 

But when there are no messages in the queue, it gets torn down and that queue name no longer exists.  When that happens I would like to return a 0, but the following returns an "Invalid Query" error:

IF EXISTS (Select * from Win32_PerfRawData_msmq_MSMQQueue where Name="os:servername\\private$\\queuename")

THEN (Select MessagesInQueue From Win32_PerfRawData_msmq_MSMQQueue where Name="os:servername\\private$\\queuename") ELSE 0

 

Any help?


Viewing all articles
Browse latest Browse all 12281

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>