Technology Solutions for Everyday Folks
A randomly-sourced handlebar moustache image from Bing Image search.

Get-RandomMustache: The Tale of an Unexpected Easter Egg

Oof -- it's been three months since my last post. I guess that's a realistic indication of how busy things have been this spring. I have a few post ideas queued up so if all goes well I'll have some content scheduled through the summer.

On that note, I had the opportunity to go to Powershell DevOps Summit in April, held out in the Seattle area. It had been on my bucket list for nearly a decade, but circumstances prevented me from attending until 2026. It was an excellent event, second in my mind only to MMS (because I have a soft spot for the MMS community). Honestly Summit is the only other event I've attended with a community feel even close to that of MMS. And it's that community feel/interaction/involvement that I think sets an outstanding event apart from just an "okay" one. If circumstances allow, I fully intend to go again...maybe I'll even pitch a couple of session ideas.

I mention Powershell Summit because while out there I was convinced to submit a lightning talk demo. I wasn't intending to speak at the event but I threw my hat into the pool to show off my Microsoft Graph API integration for Home Assistant, one of the things I'll write about separately this summer. One evening at the hotel bar I was introduced to Jason Helmick and Sean Wheeler (both of Microsoft) where over the course of our conversation Jason and I chatted about handlebar moustaches...and specifically trying to convince Sean to grow one (simultaneously with Jason). Which then led to a suggestion of "you should do a lightning demo on styling the handlebars..." to which I politely declined citing my already-submitted demo idea. The pressure to switch topics continued, but I continued to decline. This would've been a totally different conversation had I not already submitted something, because I can talk handlebars all day long. 

When it came time to prep for my five minutes of fame which is mostly a matter of making sure my special instances of Home Assistant are up to date and functioning, perhaps a couple pre-loaded browser tabs, etc., I decided to create (vibe code) a little easter egg for Jason and friends. The idea was simple: get a random handlebar moustache image for inspiration. I could then easily demo this live in front of a few hundred folks for some laughs.

A Powershell "Cmdlet"

It's not a proper cmdlet, but the Powershell function is named accordingly and wrapped in a file of the same name (Get-RandomMustache.ps1). It is pretty straightforward:

  1. Make a call to Bing image search for "handlebar mustache"
  2. Grab a random search result (what could possibly go wrong?)
  3. Open the image in the default browser

I'd originally intended to use Google image search but in testing it turns out scraping image results is way more complicated and less predictable with Google versus Bing, so Bing it was.

After a few minutes with Github Copilot, the script was born (and working as expected)! So I kept a tab in VSCode open to demo.

It was met with many chuckles. Success!

But Wait, There's A Repo!

I thought I had created a repo during or after the event, but it turns out I was just hallucinating from the excitement. I have a Github Repo for Random-Mustache that contains the code referenced in this post. Use with caution, though -- I have managed to "break" the search query handlebar mustache because I left this running in an instance of Home Assistant (along with the various manual runs of Get-RandomMustache.ps1 over the previous months). Here's hoping that by disabling the various automations I had quietly running the behavior returns to normal for the next time I demo it!

Headline image via random selection from Bing Image search for "handlebar mustache"