Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

MSMQ Peek not working right

Closed Thread
 
Thread Tools Display Modes
Old 02-28-2008   #1 (permalink)
drez
Guest


 

MSMQ Peek not working right

I am trying to peek a message off of a queue and it works, but it doesn't.
Here's the code i am using:

[Reflection.Assembly]::LoadWithPartialName("System.Messaging")
$queue = new-object System.Messaging.MessageQueue
"FormatNameIRECT=OS:servername\private$\test"
$queue.Formatter.TargetTypes = ,"System.String"
$peekmsg = $queue.Peek()
$ts = new-object TimeSpan 30000000
$peekmsg = $queue.Peek($ts)
Write-Host $peekmsg.Body

If I have the following in the body...:

<?xml version="1.0"?>
<string>hello world</string>

Then the "Write-Host $pkmsg.Body" outputs:

hello world

But if I have the following in the body...:

<?xml version="1.0"?>
<StandardDate>
<Year>0</Year>
<Month>11</Month>
<DayOfWeek>0</DayOfWeek>
<Day>1</Day>
<Hour>2</Hour>
<Minute>0</Minute>
<Second>0</Second>
<Millisecond>0</Millisecond>
</StandardDate>

Then the "Write-Host $pkmsg.Body" command outputs nothing. I have read all
sorts hits about how to do this in C#, but I can't translate that into
powershell-ese and apparently nobody in the universe is doing MSMQ with
powershell.

I'm still learning powershell, so I'm pretty much stuck. Any ideas or
examples would be appreciated!

Thanks,
/drez


Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: MSMQ Peek not working right Oisin (x0n) Grehan [MVP] PowerShell 0 02-28-2008 05:07 PM
[MSMQ]Shell for basic opeartions with MSMQ ? Oriane PowerShell 4 09-25-2007 05:11 AM
Vista/MSMQ question ESmith Vista General 6 08-27-2007 05:58 PM
New Windows Live Mail sneak peek Gary VanderMolen Vista mail 1 05-27-2007 08:24 PM
MSMQ Usage in PS Andrew Burns PowerShell 2 11-02-2006 06:43 PM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50