I have a working PowerShell script that generates JSON file and converts them to CSV. Running well when executed manually via ISE. However, I noticed that when I execute the script via Task Scheduler, the generation of JSON files are working correctly but somehow skips the part where it converts to CSV. I'm using a .bat file that was given to me to convert JSON to CSV and I just call that .bat on my PS script.
I have read somewhere that this could be because I'm trying to start a process without an interactive session and that this could be fixed by checking "Run only when the user is logged on" but I'm still getting the same result.
$path = "C:\Apps\ActiveMQanalysis\ConvertJsonFiletoCSV.bat"
Start-Process -FilePath $path
Start-Sleep -Seconds 5
Edit: This is the content of the batch file:
"C:\Program Files\Java\jdk1.8.0_181\bin\java" -cp lib* de.znt.activeMqAnalysis.BrokerStatistics C:\Apps\brokerResults\
Edit: As pointed out by most users here, I did add some logging on the .bat file to see where the error is coming from. As it turned out, it is giving me an error that it cant find or load main class de.znt.activeMqAnalysis.BrokerStatistics.