Pretty PowerShell is Better PowerShell
It should come as no surprise that I am an old-school, command-line kind of guy. I am thrilled when I can type out a command and get a result in the console. For the longest time, this was black and white. Literally. Injecting color into a DOS session was not a trivial task. Adding color is more than making a pretty picture. The proper application of color to console-based output can serve as metadata. The fact that a piece of text is displayed in red can convey additional information. At a glance, my brain can process the information on two levels, the text and how it is formatted.
A PowerShell console is no different. I can add value to my commands by incorporating color or formatting to the result I see in the console. The best way to accomplish this is by integrating ANSI escape sequences. Like regular expressions, the syntax can appear daunting at first. But I think I can help with that. I want to show you how you can include ANSI sequences in your PowerShell scripting. You’ll need this for Windows PowerShell 5.1. When we get to PowerShell 7, we have another option that I think you’ll find easier to use once you understand the ANSI sequence concepts.