WMI for queue enumeration and subject property
Exchange Server Forum Index Exchange Server
Discussion forums for Microsoft Exchange Server users.
Microsoft Outlook
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web ExchangeServerHelp.com
WMI for queue enumeration and subject property

 
Post new topic   Reply to topic    Exchange Server Forum Index -> Development
Author Message
Yuri Ivanov
Guest





Posted: Wed Sep 14, 2005 4:56 pm    Post subject: WMI for queue enumeration and subject property Reply with quote

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

Back to top
 
Post new topic   Reply to topic    Exchange Server Forum Index -> Development All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server Dedicated Servers
Contact Us
New Topics Powered by phpBB