I have the following problem: my PS script calls an external program
(actually a template processor). The external program writes error
messages to stderr. I have verified this by redirecting output with
2>err.txt. When running the PS script, the error messages from the
external program are easily overlooked because they are obviously
written to the PS output pipeline rather than to the error pipeline.
To say it another way: I would like the error message from the
external program appear as red on black as if they written with Write-
Error.
I'm using PS only occasional and I wasn't able to find a solution or
even a "best practice" how to handle errors from external programs.
Any help?
Thanks a lot.
Oisin mentioned he was planning to add even more features to the above.
Marco
"wofat68" <atlantic...@googlemail.com> wrote in message
news:b0b54f4f-23c1-4db2...@z24g2000yqb.googlegroups.com...
Indeed, I'm stuck with PS v1 for while. Thanks anyway.
My idea was to redirect stderr to a PS variable for later analysis and
output with Write-Error. I played around with Invoke-Expression and
the -ErrorVariable parameter. No success so far. I'm probably doing
something wrong here. Documentation is quite sparse. Is there at least
a way to catch stderr without redirecting to a temporary file? That
would be an enormous help.
Thanks.