PowerShell for WebSphere MQ

This has been far too long coming, but finally you can administer WebSphere MQ systems from Windows PowerShell. An extension for WebSphere MQ containing thirty-eight new PowerShell cmdlets is being released as “MO74: WebSphere MQ – Windows PowerShell library“.

I’ll write a more technical blog post that describes what sort of stuff you can do with the SupportPac. That might have to wait till next week – as is unfortunately often the way the WPS day-job is taking up a lot of my time! But in the meantime, I just wanted to write a quick post to say “I finally finished version 1, and got it out the door”! 🙂

Update: Want to see what it can do, but don’t have time to try it out? Download the zip file and take a look at the doc “A cookbook for ‘PowerShell for WebSphere MQ'” (powershellcookbook.pdf) that is in there. I’ve put a bunch of examples of commands there with sample output.

Update 2: I’ve made a start on describing how the PowerShell stuff can be used on the WebSphere MQ blog

Tags: , , , , , ,

11 Responses to “PowerShell for WebSphere MQ”

  1. Jeffrey Snover says:

    I can’t tell you how thrilled I am at the great job you’ve done here. I’m not at all surprised. A lot of people are quick to say how much PowerShell looked to Unix for inspiration but for some reason people don’t pick up on my statements about how important the AS400 CL and VMS DCL models where in the conceptual model for PowerShell. Both environments had the system do the parsing instead of the command. The UNIX mindset is one where individual elements of the pipeline consume arbitrary amounts of data from an undifferentiated byte stream. I rejected that model and replaced it with a model much more in aligned with IBM’s traditional RECORD orientation. We say that PowerShell is “object based” but the reality is that the object in the pipeline and the arguments on the command line combine to create a RECORD and then we call “ProcessRecord”. Anyway, I’m not surprised that you guys did a great job – congratulations!

    In your cookbook you have the example:
    Get-WMQQueue | Where {$_.QueueType -eq [IBM.WMQ.MQC]::MQQT_LOCAL -and $_.CurrentDepth -gt
    ($_.MaximumDepth – 10)} | Select Name, CurrentDepth, MaximumDepth

    I’m curious, does this work for you:
    Get-WMQQueue | Where {$_.QueueType -eq “MQQT_LOCAL” -and $_.CurrentDepth -gt
    ($_.MaximumDepth – 10)} | Select Name, CurrentDepth, MaximumDepth

    If so, it is a little easier to remember.

    If you don’t mind a few suggestions.
    Get-WMQChannel | Where {$_.SSLCipherSpec -ne ”}
    could be:
    Get-WMQChannel | Where {$_.SSLCipherSpec}

    Also – when dealing with ENUMs one of my favorite tricks is to either cast an invalid string or assign an invalid string to the property. Either way, PS tells you what the valid values are. e.g.
    PS>[system.consolecolor]”asdf”
    Cannot convert value “asdf” to type “System.ConsoleColor” due to invalid en
    umeration values. Specify one of the following enumeration values and try a
    gain. The possible enumeration values are “Black, DarkBlue, DarkGreen, Dark
    Cyan, DarkRed, DarkMagenta, DarkYellow, Gray, DarkGray, Blue, Green, Cyan,
    Red, Magenta, Yellow, White”.
    At line:1 char:22
    + [system.consolecolor] <<<

    Jeffrey Snover [MSFT]
    Windows Management Partner Architect
    Visit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell
    Visit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

  2. […] Lane from IBM posted a blog entry HERE describing a set of PowerShell Cmdlets to manage WebSphere MQ.  You can download the PDF […]

  3. […] Lane from IBM posted a blog entry HERE describing a set of PowerShell Cmdlets to manage WebSphere MQ.  You can download the PDF […]

  4. […] Lane from IBM posted a blog entry HERE describing a set of PowerShell Cmdlets to manage WebSphere MQ.  You can download the PDF […]

  5. dale says:

    @Jeffrey Snover

    Many thanks for your kind comments – and for your suggestions. In particular, using enum’s in the Where queries – that has long been a bit that I wasn’t happy with. When demonstrating ‘PowerShell for WMQ’ to colleagues, that has always been the bit that has jumped out to them as looking complicated.

    Now I can do:

    PS C:\> New-WMQQueue TESTQ -QueueType Local
    PS C:\> Get-WMQQueue | Where {$_.QueueType -eq "Local"}

    which is so much nicer. I’ll be updating the ‘cookbook’ with this soon, so many thanks for your help!

  6. […] off to PowerShell, AS400 and Dale Dale spotted a great write up of his PowerShell for WebSphere MQ SupportPac this morning. I was also really pleased to see that I wasn’t imagining the AS400 […]

  7. […] belive me, see with your own eyes – Dale Lane from IBM posted a blog entry HERE describing a set of PowerShell Cmdlets to manage WebSphere MQ.  You can download the PDF […]

  8. […] IBM Dale Lane ??????????? ????? ?? 38-?? ??????????? Powershell ??????????? ????????? […]

  9. J Allen says:

    From what I can tell, this is still the first IBM product to have PowerShell support. I’ve asked numerous times in the DB2 forums for PowerShell support, but no one seems to “get it”. Is there any way at all you could talk to someone on the DB2 team(s) and encourage them to writing similar cmdlets for DB2? Please?

    Awesome work – I hope it’s a precursor to much more PowerShell support from IBM.

  10. Mark says:

    Dale,
    I know it’s been a while and maybe you aren’t even working on IBM stuff anymore… but I followed the rabbit trail and didn’t find any further information on any of the resulting myriad of websites and IBM pages…

    Do you know if there are any plans to update this for MQ ver 7 ? And if not, any chance the code might go open source so someone in the community can add support?

  11. dale says:

    Mark – I don’t know, sorry. As you guessed, it’s been a few years since I worked on WMQ stuff, so I’m a little out of touch.

    If you’re an IBM customer, I’m sure your normal Support rep will be able to let you know, and if it’s not available, give you a way to register your requirement for it. (By the way, if you find out, I’d be interested to know.)