Friday, 15 March 2013

Powershell Delete aged MSMQ messages in specific queue -


OK, so new to working from MSMQ message in power shell. And I'm sure I'm stupid stupid. I want to remove the old message from X days with a specific queue if anyone has some idea on how to do this, I will take it here what I have got to do: / P>

  $ today = get-date $ today = $ today.Adddays (-30) $ queuePath = ("$ $ private \ thequeueIwant") [Reflection.Assembly] :: LoadWithPartialName ("System .message ") $ queue = New-Object System.Messaging.MessageQueue $ queuePath $ queue.GetAllMessages {if ($ _ time add-4 $ $) {$ message.delete}}  
< / Div>


No comments:

Post a Comment