Tuesday, January 8, 2019

IBM WebSphere MQ PowerShell SnapIn

I found myself responsible for the operation of some servers that use IBM WebSphere MQ.
Slowly over time, my manager thinking that another team was responsible for the operation of the software, and would provide all the technical support for the product. So he instructed me to stay hands off on the software. Just maintain the os and the IIS components. 

Well, for better or worse, the IBM software was fairly stable, but over time, issues like memory leaks required us to restart the web app pool. More issues came up demanded answers from management, and the support team that was to take care of WebSphere MQ dissolved quietly. While a few staff that new the product remained, they moved off to development products. Another engineer left the company. So I was left the SME on the product. So.. I had to become more familiar with the Product and to support the new engineer and the team that took over the MQ support for the system. I needed a health check for the product to help understand what it was configured and how it was performing. 
So did my research and I found that IBM had published a snapin for the product, and was still supporting it. I Know PowerShell, and that module was very priceless in figuring out what the configuration was doing. 

Here I share my experiences with installing Powershell Support for IBM WebSphere MQ.

The 32-bit installer is simple.
However, the 64-bit version is a bit cryptic.

The wonderful module that IBM provided can be found:
LINK: MO74: WebSphere MQ - Windows PowerShell Library

Install file in the zip.:
  • Unzip the downloaded file:  mo74_v2.0.1.zip to a work directory/folder on your target computer. 
  • Open the work folder, and switch to the sub folder/directory:  \mo74_v2.0.1.zip\mo74_v2.0.1\mo74_v2.0.1_x86_x64
  • RUN the installer: setup.exe

Follow the standard GUI install process. (AKA the forehead install. )

There is a directory created by default in:

  • C:\Program Files (x86)\IBM\PowerShell for WebSphere MQ

This contains files you need for 64 Bit support.
Now, WHY would you want 64-bit support???
Well, most servers these days are 64-bit, and the Remote Powershell stuff on a 64-bit computer uses the 64 bit Powershell version. and the Snapin installs in only the 32-bit version of PowerShell.

You can use this following PowerShell script to install the WebSphereMQ 64-bit support snapin.

Script:
$path = "c:\Program Files\WindowsPowerShell\Modules\WebSphereMQ\"

mkdir $path -Verbose -ErrorAction SilentlyContinue

COPY "C:\Program Files (x86)\IBM\PowerShell for WebSphere MQ*" $path

CD $path

"Change Dir to: $PWD"


$DLLS = GCI *.dll

$FWInstall =
    gci C:\Windows\Microsoft.NET\Framework64\v4.* `
        -Recurse -Filter "InstallUtil.exe"
    #Line wraped with backtick.
& $FWInstall.FullName $DLLS

#Save the current value in the $p variable.
$p = [Environment]::GetEnvironmentVariable("PSModulePath")

#Add the new path to the $p variable. Begin with a semi-colon separator.
$p += ";$PWD"

#Add the paths in $p to the PSModulePath value.
[Environment]::SetEnvironmentVariable("PSModulePath", $p)
* you can use this code and the contents of the dir and install as part of a server build script. 

The installer program provided with .NET is verbose and will tell you how the process of registering the DLL's goes. 

Snapin is loaded with the following:
Add-PSSnapIn IBM.PowerShell.WebSphereMQ

You can check to see if the commands have been added with the following command


Get-Command *WMQ*


>> How to use all these nifty new commands is Subject of another article.