With PowerShell, how can I get Write-Debug output to appear in the console?

Viewed 26914

I'm learning PowerShell and was using Write-Host to check variable assignments in a new PowerShell script file. Then I read an article suggesting this was a bad idea.

So, in my .ps1 file I replaced statements like this:

Write-Host "Start"
Write-Host "End"

... with this:

Write-Debug "Start"
Write-Debug "End"

But when I ran the saved script in Windows PowerShell ISE no output was written to the console. I appended -debug to the statement that calls the script, like so:

PS E:\trialrun> .\MyScript.ps1 -debug

But again, the output doesn't get written to the console. Apparently I'm using Write-Debug incorrectly. How can I get the debug output to write to the console?

2 Answers
Related