I want to run one of our taskflow continuously until I finish all the files in a windows folder. This task can process only one file at a time. Currently i am running this task using 5 mnt infomatica schedule. Usually this task last under 1 minute.
Now I am hoping that I can run RunAjobCli utility inside a loop written in powershell script , this will trigger the infomatica taskflow continuously until I finish my files. But I am not sure how do I call this utility in Powershell.
I have tried calling bat script from powershell loop , but the loop is triggering the utility all at the same time ( all the instances are throwing error - "The Mapping task failed to run. Another instance of the task is currently running". except one which is finishing successfully after processing one files from the windows folder.
My powershell script
write-host "Setting location"
Set-Location -Path C:\OPTS\Test
# checking if the file exist
$filetocheck = "C:\OPTS\Test\*xml"
$InfomaticaPath = "C:\Program Files\Informatica Cloud Secure Agent\apps\runAJobCli\"
if (Test-path $filetocheck)
#Rename-Item "C:\Testfile.txt" "newname.txt"
write-host "this file does exist"
$targDir = "$PWD";
$filesNames = Get-ChildItem $targDir -Filter *.xml
#looping through all the files
$FileCount = 0
write-host "Inside the if checking next to process"
foreach ($filesName in $filesNames)
$FileCount = $FileCount + 1
Copy-Item $filesName -Destination "C:\OPTS\Test\Processed" -force
Rename-Item $filesName "next_to_process.xml"
Start-Process "cmd.exe" "/c C:\OPTS\Test\Run_Optionals_process_changes_orig.bat"
write-host "this file does not exist"
Bat file code
cd "C:\Program Files\Informatica Cloud Secure Agent\apps\runAJobCli"
Echo "This msg inside the batch bat , before the Infmatica call"
cli.bat runAJobCli -n "UAT_orig" -t MTT -w true
if %return_code% NEQ 0 (