Welcome to this addition of the PowerShell ABC's where you'll find 26 posts detailing a component of the PowerShell scripting language, one letter at a time. For today's letter of "Y", I'll discuss PowerShell's host interface and, most importantly, it's ability to specify one of my favorite colors Yellow.
PowerShell is really an engine that operates within a hosting application, the default being the PowerShell.exe command line application. The host serves to expose a command line and a host interface to communicate with the commands invoked by the command line.
There are several buildin CmdLets for working with the containing host.
The interesting object here is the UI member of type InternalHostUserInterface most likely derived from the PSHostUserInterface interface. A call to Get-Member on that object will display the supported commands:
You'll see some obvious relationships here to the other Cmdlets dealing with I/O such as Write-Progress, Write-Debug, Write-Warning, Write-Error and so forth.
Securing Your Output
I hinted on Yellow above in that you can control the foreground and background color of console output. Here's a practical application of using color. Consider the case where you are running a long-lived process that prints sensitive information to the console and you don't want to have others peek over your shoulder and read it. This is a perfect example of using the output color schemes. In this case, you can make the foreground and background color the same and it will look just like a color block. When you want to retrieve the output text, you can always cut and paste it from the console, but you won't be able to read it directly!