IBM WS MQ7.5, windows MQMFT agent, linux MQ manager.
I am trying to run a powershell script as defined in the xml of a MQ mft ant script.
I configured the path to the powershell scripts in commandPath of the agent.properties files.
The managed call starts but fails
<fte:presrc command="C:\IBM\MFT\script\MoveFileToArchive.ps1" successrc="0">
<fte:arg value="${base.file}"/>
</fte:presrc>
The error reads
cannot run program createprocess error=193 MoveFileToArchive.ps1 is not a valid win32 application
I tried to add the path to powershell with powershell.exe defined like so
<fte:presrc command="C:\windows\system\windowspowershell\v.1.0\powershell.exe C:\IBM\MFT\script\MoveFileToArchive.ps1" successrc="0">
<fte:arg value="${base.file}"/>
</fte:presrc>
This doesnt work either.
As can be seen from the error, MFT agent is using
CreateProcessAPI to start a program.CreateProcessAPI can run only executable file. ThePowershellscript you are using is a non executable. Hence the error.If you want to be able to open any file with its associated application then you need
ShellExecuteinstead ofCreateProcess. But this is not under your control. So need to look for alternative?Try using a batch file say
ps.cmdand in the batch file you run the PowerShell script likeWhere %1 would be the argument for PS script.
The Ant script also needs bit of a change.
I am sure you have already set the
commandPathproperty to a suitable value in agent.properties.Give it a try.