1

I'm trying to call mqsiprofile from a powershell script and it is successful. However, when i run other mqsi commands like mqsilist or mqsicreatebroker, I am getting the below error:

The user environment was not adequately prepared to continue execution. Locate and run the profile supplied with the product. This file is called mqsiprofile, and is located in the bin subdirectory for the product.

I have the windows environment variable PATH set to the bin directory where mqsiprofile command lies.

I tried the same from windows command prompt and all the commands were successful. It seems like the environment is not being persisted after the command execution in powershell.

Any suggestions?

JoshMc
  • 10,239
  • 2
  • 19
  • 38
abhi88
  • 303
  • 2
  • 4
  • 15
  • 1
    Review this answer "[How can I source variables from a .bat file into a PowerShell script?](https://stackoverflow.com/questions/20077820/how-can-i-source-variables-from-a-bat-file-into-a-powershell-script/20078088#20078088)", you also have the option writing a batch file wrapper that would first call `mqsiprofile` then call the powershell script since the powershell script will inherit the environment variables set before the batch starts powershell. – JoshMc Jan 30 '19 at 09:29
  • Possible duplicate of [How can I source variables from a .bat file into a PowerShell script?](https://stackoverflow.com/questions/20077820/how-can-i-source-variables-from-a-bat-file-into-a-powershell-script) – JoshMc Jan 30 '19 at 09:30
  • Hello, IIB profile on windows is apparently not working on PowerShell. I havn't found any record of someone who used power shell for IIB commands, there is already a topic opened on the IBM forums, but no one got the answer : http://www.mqseries.net/phpBB2/viewtopic.php?p=419906&sid=4025b60925c81d2002b0807002e3ebea I would recommend you to simply launch "iib.cmd" and then use bat or other scripts running with the cmd. – jdel Feb 08 '19 at 07:10
  • I kept searching, and apparently this issue is quite simple : you need to load the profile before launching PowerShell : http://www.mqseries.net/phpBB/viewtopic.php?p=424760&sid=016c48d2cd238ee7bfd60c4f3eeee29e – jdel Feb 08 '19 at 07:47

2 Answers2

2

If you use windows then execute this command to load mqsiprofile and you can use the IIB toolkit

C:\Windows\System32\cmd.exe /T:0A /K "title IBM Integration Console 10.0.0.3 & cd C:\Program Files\IBM\IIB\10.0.0.3\ & IIB.cmd"

Now you can use mqsideploy, mqsicreatebar, mqsiapplybaroveryde and other binaries.

If it is necesary you change the directory of the IIB toolkit, I use C:\Program Files\IBM\IIB\10.0.0.3\

JoshMc
  • 10,239
  • 2
  • 19
  • 38
Cr T
  • 21
  • 4
0

Faced this problem when invoking mqsideploy using ant build script in Jenkins with IBM Integration Bus v10. Cr T's answer helped. Rather than copy the line, it is better to take the actual command invoked, which can be found in the properties of the shortcut icon corresponding to the IIB Console.

In addition to the suggestion, the following was done. Created a simple batch file and chained the required command to be invoked which in this case was mqsideploy. This can further be developed so that the ant script passes the variables to the batch script.

The batch script contained the following line (The color and title was dropped for simplicity )

C:\Windows\System32\cmd.exe "cd C:\iib\ & IIB.cmd & mqsideploy -i localhost -p 4414 -e default -a C:\wks\bardir\TestApp-11.bar -m"

The batch was then invoked from Jenkins as another build step. This worked.

Mak2006
  • 165
  • 1
  • 8