A lot of my PowerShell work lately has involved color. I find myself using ANSI escape sequences quite often. I’m also playing with different color schemes in Windows Terminal. And I still on occasion find myself using Write-Host to display colorized messages. What has gotten trickier is that Windows Terminal schemes can redefine colors. What…
Tag: Write-Host
A Timely PowerShell Prompt
During the course of writing a few scripts that refresh a specific part of the console, such as the recent Read-Host alternative, I realized that flashing colors wasn’t always necessary. The fact that I could update the same space on the screen meant I could write the same content with minor changes and it would…
Friday Fun Send a Colorful Message
Next week is Pluralsight’s 10th anniversary. In preparing for that happy event, I wanted to send a special greeting. Of course, because my courses are on PowerShell it only seemed appropriate to use PowerShell to display my message. In fact, let’s jump right to the result. Here’s how I did it. #requires -version 3.0 #get…
Another PowerShell Valentine
I’ve been sharing some Valentine’s Day themed fun on Twitter today. This one is a bit too long to fit into a tweet. $text = “Happy$([char]3)Valentine’s$([char]3)Day” $text.ToCharArray() | foreach -begin { $colors = “Cyan”,”Magenta”,”Yellow”,”White”,”Red”,”DarkRed”,”Green” } -process { write-host $_ -NoNewline -ForegroundColor ($colors| Get-Random)} -end {“`n”} To get the full effect you need to run in…
Updated Console Graphing in PowerShell
The other day Distinguished Engineer and PowerShell Godfather Jeffrey Snover posted a blog article about the evils of Write-Host. His take, which many agree with, is that Write-Host is a special case cmdlet. In his article he mentions console graphing as an example. I wrote such a script earlier this year. Mr. Snover’s post drove…
PowerShell Console Graphing Revised
Many of you have been having fun with my PowerShell Console Graphing tool I posted the other day. But I felt the need to make one more major tweak. I wanted to have the option for conditional formatting. That is, display graphed entries with high values in one color, medium in another and low in…
Graphing with the PowerShell Console
I’ve written before about using the PowerShell console as a graphing tool, primarily using Write-Host. Most of what I’ve published before were really proof of concept. I decided to try and come up with a more formal and re-usable tool that could create a horizontal bar graph based on a numeric property from piped objects….
Valentines Day PowerShell Fun
In case you missed some of the fun on Twitter and Google Plus, here are the PowerShell valentines I sent today. These are intended to be run from the PowerShell console, not the ISE. Also, depending on your console font, you might get slightly different results. I use Lucida Console. #1 write-host (([char]3…
Friday Fun PowerShell Valentines Day
With Valentine’s Day just around the corner, I thought I should help you out with your gift giving. Remember those bags of candy with the cute sayings like “Be Mine”? Here’s how you can create a “bag” of them using Windows PowerShell; perfect for that extra geeky significant other. Or maybe you’ll just have fun…
Friday Fun: Output to 2 Places in 1
Today’s Friday Fun comes out of a short exchange I had yesterday with Hal Rottenberg on Google Plus. We were playing around with piping a PowerShell command to Clip.exe which dumps the output to the Windows Clipboard. I got to thinking about taking this a step further based on my needs as a writer. Often…
Friday Fun Drive Usage Console Graph
I think you’ll like this. Normally, I prefer my PowerShell commands to write objects to the pipeline. But there’s nothing wrong with sending output directly to the console, as long as you know that the output is intended only for the screen. What I find frustrating is the use of Write-Host when really, pipelined objects…
Friday Fun: Start-TypedDemo v2
Not too long ago I posted a function I wrote for doing PowerShell demonstrations. My goal was to simulate a live interactive demo but without the typing so I could focus on explaining and not typing. The first version was a good start but I always had plans for a more feature complete function including…
Start-TypedDemo
As you know, I do a lot of presenting and training. Normally I use the ubiquitous Start-Demo function to run through a demo list of commands. Most of this time this works just fine. But when I’m doing videos, especially for a video project, I want the viewer to focus on the command and not…
Friday Fun Out-Rainbow
For my readers who are just discovering my Friday posts, let me remind you that these are not necessarily practical, production worthy PowerShell scripts and functions. They are meant to be fun, yet educational. For example, in today’s Friday Fun I have a function that takes string input and writes colored output to the console….
We Pause a Moment
Most of the time when running a PowerShell script or series of commands you want to blast your way through. But there might be times where you want to pause script execution. Perhaps to display an informational message or to simply pace execution. In my work as a trainer and speaker I often use the…