PowerShell – Random Holiday

You ever want to collect a random holiday to spice up your report? No? Really? Just me? Whatever.

In Action:

I have two sections, they do the same thing basically.
First group checks the website RSS for the “Holidays” today, then grabs a random one and writes places it into $EventPicked, then writes it to the console
The Second Group does the same, but modifies it for my own purposes… placing it into a variable and writing it to the console for fun.

How it works. Based on the website “Checkiday.com”, the script grabs their RSS in XML format,(after confirming it can connect) digs through it and returns all of the different events for that day into $EventNames”
From there, I count the items, then have PowerShell pick a number between 0 & the total number of “Holidays” that are in that variable, and place it into $EventPicked”

Script: https://github.com/gwblok/garytown/blob/master/RandomHoliday.ps1

Unsure if you have any use for this, but thought it was at least fun.

This is how it gets used in my environment. Just bringing a smile to others in the Console.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.