Yuri Ivanov
Guest
|
Posted:
Wed Sep 14, 2005 4:56 pm Post subject:
WMI for queue enumeration and subject property |
|
|
Hello,
I have a script letting me to enumerate messages in the queues. But for
Subject Property it always returns "<Subject is hidden>".
"Enable subjects logging and display" server's property is enabled since
many months. If use System Manager under the same account, subjects can be
seen.
Thank you for the help!
Yuri.
The script:
Option Explicit
Dim objWMIService, Queues, Queue, Links, Link, strComputer, Messages,
Message
'Connection to wmi
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject _
("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer &
"\root\MicrosoftExchangeV2")
'Enumeration
Set Links = objWMIService.ExecQuery _
("Select * from Exchange_Link where MessageCount>0")
For Each Link in Links
Set Queues = objWMIService.ExecQuery _
("Select * from Exchange_Queue where MessageCount>0" & _
" And LinkId='" & Link.LinkId
& "'" & _
" And LinkName='" &
Link.LinkName & "'" & _
" And ProtocolName='" &
Link.ProtocolName & "'" & _
" And VirtualMachine='" &
Link.VirtualMachine & "'" & _
" And VirtualServerName='" &
Link.VirtualServerName & "'" & _
"" )
For Each Queue in Queues
Set Messages = objWMIService.ExecQuery (
"Select * from Exchange_QueuedMessage " & _
" Where LinkId = '" &
Queue.LinkId & "'" & _
" And LinkName = '" &
Queue.LinkName & "'" & _
" And QueueName = '" &
Queue.QueueName & "'" & _
" And QueueId = '" &
Queue.QueueId & "'" & _
" And ProtocolName = '" &
Queue.ProtocolName & "'" & _
" And VirtualMachine = '" &
Queue.VirtualMachine & "'" & _
" And VirtualServerName = '"
& Queue.VirtualServerName & "'" & _
"" )
For Each Message in Messages
WScript.echo "Subject: " &
Message.Subject
Next
Next
Next
|
|