This week I thought we’d have a little fun with the PowerShell console and maybe pick up a few scripting techniques along the way. Today I have a function that changes the foreground and background colors of your PowerShell console to random values. But because you might want to go back to your original settings…
Tag: Friday Fun
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…
Friday Fun: The Measure of a Folder
Last week, I demonstrated how to measure a file with PowerShell. This week let’s go a step further and measure a folder. I’m going to continue to use Measure-Object although this time I will need to use it to measure numeric property values. Here’s the complete function after which I’ll point out a few key…
Friday Fun: The Measure of a File
I’ve been working with PowerShell since the days of Monad and have written a lot of PowerShell scripts. Out of idle curiosity, and the need for a Friday Fun topic, I decided to see how many lines of PowerShell I have written. Or at least that are in my Scripts folder. Turns out I have…
Friday Fun with REST, Regex and Replacements
I just love using the web cmdlets that were introduced in PowerShell 3.0. One of the cmdlets I use the most is Invoke-RESTMethod. This isn’t because I’m dealing with sites that offer REST-ful services, but rather I like that the cmdlet does all the heavy lifting for me when I point it to an RSS…
Friday Fun: Does Anyone Really Know What Time It Is?
In PowerShell it is brain-dead easy to get the date and time with Get-Date. If you look through articles I’ve posted you’ll find plenty of examples using Get-Date and the [DateTime] object. But now that we’re getting ready for a new year, I thought you might be planning ahead and might want a few shortcuts…
Friday Fun: A Christmas Present for You
Over the years a number of people in the PowerShell community have shared Christmas and holiday related items. I’ve collected them and in some cases tweaked a little bit. This year I decided to wrap them all up in a module for you. This will work in PowerShell 2.0 and later. #requires -version 2.0 <#…
Friday the 13th PowerShell Fun
Well here are once again and another Friday the 13th. I love these days because I feel challenged to come up with 13 PowerShell related tidbits which I hope you’ll find fun and maybe even a little educational. Today’s collection should work primarily on PowerShell 3.0. Most items might also work on PowerShell 2.0. A…
Friday Fun: 50 Shades of PowerShell HTML Reports
I’ve been working on a project for a client that includes creating an HTML report, generated by PowerShell. I originally thought I would include a certain feature but decided against it. However, this is so cool I thought I’d share it with you as a Friday Fun article. I’ve done alot this year with some…
Friday Fun: Pi-romania
I was doing some benchmarks the other day, and one of the tests was a calculation of pi using a particular algorithm. I found that quite interesting and naturally this made me curious if I could do the same calculation in PowerShell. Of course, if all you need is the value of pi, that is…
Friday Fun: Out-ConditionalColor
Last week I posted a Friday Fun article on parsing results from Invoke-Webrequest and displaying matching strings in color so that the book titles I’m interested in stand out. But the more I thought about it I realized I should take this a step further. The problem with Write-Host is that it doesn’t write anything…
Friday Fun: Get Friday the 13th
I thought it might be fun today to use PowerShell to discover all the Friday the 13ths in a given year. So I put together a simple PowerShell one-liner. To make it flexible I’ll use a variable for the year, using the current year as my value. $year = (Get-date).Year Because there can only be…
Friday Fun: Get Day of the Year with PowerShell
Earlier this week I was having some fun with @EnergizedTech on Twitter, playing around with dates in PowerShell. I’m not even sure where we started but the experience got me thinking and it’s Friday so let’s have some fun. While I can easily find out what the day of the year is for a given…
Friday Fun: New-Thriller Revised
A few years ago I posted a PowerShell script to autogenerate a synopsis for a standard thriller. It was a lot of fun and demonstrated out to build complex strings using the -F operator. I decided to revisit this script and tweaked it some. The main change is that instead of using the -F operator,…