I am learning PowerShell and using Write-Host to check the assignment of variables in a new PowerShell script file. Then I read an article that said it was a bad idea.
So, in my .ps1 file, I replaced the statements as follows:
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, nothing was output to the console. I -debugrefer to the statement that the script calls, something like this:
PS E:\trialrun> .\MyScript.ps1 -debug
But then again, the output is not written to the console. Apparently I'm using Write -debug incorrectly. How can I get debug output for writing to the console?
source
share