This series will touch on a number of best practices around Windows PowerShell, specifically on things that you should (almost) ALWAYS do... and some things you should (almost) NEVER do. Let's kick things off with a "NEVER DO:"
Never use Write-Host.
Write-Host is the only native PowerShell output cmdlet that writes directly to the console window, rather than to a pipeline. By bypassing the pipeline in this fashion, Write-Host seriously limits its functionality - but it also picks up the ability to write text in specified colors. So I'll temper my "never" with this: Only use Write-Host if your goal is to display some kind of colorful splash screen, not unlike the one you get when you open the Exchange Management Shell.
When I teach classes, I like to have my students come up with reasons why they SHOULD use Write-Host... and then, in most cases, tell them what they should be doing instead for those purposes. Here are some examples:
So there are a very few instances where Write-Host is the write - er, right - way to go. In most cases, your needs would be better met by another technique or cmdlet. Write-Host is often the go-to cmdlet for folks with extensive VBScript experience, who are used to using WScript.Echo to create script output. That was great for VBScript, because it dealt primarily with text, and didn't have many other options for output. By PowerShell isn't VBScript... so (almost) never use Write-Host!