“Write-Error” (write in Powershell, used in C#) works BUT Write-Debug doesn´t work – Why?

Question:

I have written a program with C#, that creates a logfile and fills this by using log4net. This program starts powershell-scripts. The scripts use log4net, too.
It works:

Now I want add to use the standard Write-Error, Write-Debug, etc. CMDlets in my Script.
(looks like here – answer of Hinek).

works, but the following doesn´t work:

… I get an error in my logfile, too. The error looks like this:

(I think to have all namespaces.)

What the error-message means and what can I do again this?

thanks

Answer:

Now I had found the answer myself:

and this for write-debug:

Source:

“Write-Error” (write in Powershell, used in C#) works BUT Write-Debug doesn´t work – Why? by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply