I added a subtle "Now playing" text to the footer of this site which represents the first result in the response from
the user.getRecentTracks method on the Last.FM API. The data is
updated every few seconds with a little bit of JavaScript by polling a small Pode web service running in my home lab.
A while back I was helping a co-worker with a project where the customer needed
to automate a lot of minor Windows configuration steps on some Windows IoT
server appliances. One of the tasks was to make it possible to disable Windows
Firewall, because even an administrator was greeted with the message "For your
security, some settings are managed by your system administrator" and the option
to change firewall settings was disabled.
I recently came across a couple of blog posts on image comparison
algorithms shared by Dr. Neal Krawetz. One of them, titled "Kind Of Like That",
describes the "dHash" algorithm which generates a perceptual hash based on
gradients in the image. With more than 200k family photos to wrangle, I wrote up
a PowerShell implementation to find similar images and it works surprisingly well!
Back in 2021 I wrote a module called Poshover
for sending push notifications with Pushover.net. This
week I decided to use that module as a reference during my PowerShell + DevOps Summit
workshop in a few weeks. I never liked the name, so I renamed it to PSPushover
and set it up in a new repository.
Are you testing your documentation? If you write PowerShell scripts or modules, you are hopefully using Pester to
test your code. And if you use PlatyPS to generate markdown documentation like I do, then you have a bunch of example
PowerShell code sitting in .md files. But what happens if you rename a command, a parameter, or make a breaking change?
I had a need to generate a markdown table dynamically from PowerShell, so I wrote a flexible function which uses the
properties on the incoming objects to define the column names, supports the definition of maximum column widths, and
outputs either pretty-printed markdown with padded values and aligned columns, or "compressed" markdown without the
unnecessary padding included.
My co-worker, Jared, who regularly uses MilestonePSTools and builds tools with it brought me an interesting problem yesterday - an apparent compatibility issue between our SDK and the ConvertTo-Json cmdlet from the built-in Microsoft.PowerShell.Utility module. If you've ever struggled with the error "ConvertTo-Json : An item with the same key has already been added.", follow along as I share our debugging process until we finally discovered the root cause. While the details in this post involve the Milestone SDK and the MilestonePSTools module, the root cause and the process of finding it is relevant to anyone using .NET assemblies or 3rd party modules with PowerShell.
Argument transformation attributes make it possible to offer your users
some flexibility in how they supply values for parameters. I've started to use
these in the MilestonePSTools module to
make it possible to provide a name instead of a strongly typed object like a
[RecordingServer] or a [Role], while still making it clear in the
Get-Help documentation what the expected object type is, and without
polluting functions with object transformation code.
One of the things I love about PowerShell is the focus on usability and
discoverability. The PowerShell team, and the community, have invested so much
into reducing friction and accelerating your workflow. Argument completers are
one of the tools available to you, and you should consider adding them to your
projects if you aren't doing so already.