How to troubleshoot "The pipeline has been stopped"

I have a large PS script and I am looking for advice in troubleshooting thie error: "PS>TerminatingError(): “The pipeline has been stopped.” This error occurs in the log file generated via Start-Transcript. I have no idea how to figure out where the pipeline breaks as the script is huge. The last item successfully logged to the log file is only about 10% into the script, yet the script completes tasks past this point.

Some other key points. The end result of the script is an HTML file which does not get written to file until near the end of the script, and this completes, so in essence, the script completes most of what is expected. The remainder of the script does not complete, but if I can get the log entries to appear, I can troubleshoot this.

Also, the script runs fine from the command line. This error only started when I moved it to a Scheduled Task. I have the Task running via the SYSTEM account if that helps.

I know someone will suggest “post the code”, which is impossible due to the script size.

Any suggestions on methods to troubleshoot this error are welcome and appreciated.

looks like a permission issue when ran as system account. Try running as some other account from taskscheduler to confirm.

Well this turned out to be my own stupidity. I was looking at the wrong log file, the SYSTEM account uses C:\Windows\Temp for $ENV:Temp …

Sometime you gotta wonder. Sorry for the bother.