Peeking Windows Azure Queues using Windows PowerShell
Sometimes you have messages in a queue, and you want to have a peek at them (or even read and remove them). The most obvious answer to this is to build a little utility that allows you to browse queues, peek messages etc. But did you already know the CloudDrive Windows PowerShell provider already lets you do it!
Here is how you can get at the queues.
- Extract samples.zip to a folder, and using the buildall cmd – build all the samples.
- Navigate into the samples\CloudDrive folder, and execute the runme.cmd. This will install the PowerShell provider ready for use.
You should now be in PowerShell, and be able to issue commands such as
dir blob:
and
dir queue:
you can even execute
cd blob:
and use dir etc. to navigate the blobs.
So now for the queue, my queue is called messages so executing
dir queue:\messagequeue
yields
as you can see i have a single message in the queue. To read the message, first I need a reference to a queue.
$q = (dir queue:\messagequeue)
I can now call get-member on the $q object and view a list of methods and properties available.
$q | get-member
Note we have all the methods available in the queue, including PeekMessage. To read that first message I can call
$q.PeekMessage()
Which gives:
Finally, I can view the contents of the message using
$q.PeekMessage().ContentAsString()
Which gives my message content.
Hopefully using this little starter, you will be able to figure out how to create and manipulate queues and messages.
THIS POSTING IS PROVIDED "AS IS" WITH NO WARRANTIES, AND CONFERS NO RIGHTS
| Share this post : | ![]() |
![]() |

