Author Posts

April 20, 2018 at 8:46 pm

Hey everyone –

I've got a question about screen output. I've got a module that I am working on that currently has a lot of verbose output. The question that I've got is — *some* of the verbose output is considered more important than others, as the screen output is a decent amount.

When the function runs into potential problems, I use Write-Error / Write-Warning, but the rest is Write-Verbose. I am trying to figure out a way to draw attention to the more important verbose information. The easy answer would be to change the foreground color of these more important messages (I have no interest in killing puppies using Write-Host).

Would changing the verbose output color for these certain messages be a good idea? Or is that something typically frowned upon? I was also looking at Write-Information – but I see that outputs to the screen in white – and I believe you lose some of the built in functionality you get with Write-Verbose.

How would something like this typically be handled?


April 20, 2018 at 10:28 pm

Depending on their content, you might consider utilising Write-Debug for the "less important" verbose messages.

It's certainly possible you're overdoing it with the output. Is it all really necessary? Does it provide useful information? Are you duplicating information? Are you being overly verbose when you could be more succinct?

April 25, 2018 at 4:24 pm

Thank you for the responses. I agree – I am probably over doing the verbose output a little bit. I may be able to get what I want out of Write-Progress. I am going to dig into that a little to learn about it.

Also – thank you for linking the style guide. I am always looking for reference material like this.