Can anyone help me with the question. I'm trying to get msmq messages count with vbscript.
Dim MSMQApp
Set MSMQApp = CreateObject("MSMQ.MSMQApplication")
Dim qFormat
For each qFormat in MSMQApp.PrivateQueues
WScript.Echo qFormat
Dim Mgmt
Set Mgmt = CreateObject("MSMQ.MSMQManagement")
Mgmt.Init ,,"DIRECT=OS:" & qFormat
WScript.Echo CLng(Mgmt.MessageCount)
Next
There is a private queue - I see in WScript.Echo qFormat. But when Init I have an error: The queue is not open or may not exist.
Help me, please.
The problem was - "An exception is thrown and a nonspecific MQ_ERROR (0xC00E0001) error is generated if the destination or outgoing queue specified does not contain any messages and no handle to it exists." There is queue, but there is no messages in it - exception.