Itty Bitty Rants

Infrequent posts about stuff.

  • Is This Thing On?

    This is just a post to see if IFTTT integration is working to automatically post to my Twitter account…

  • Some Migration Notes

    As I mentioned in the previous post I am hosting this blog on Azure Static Web Apps now using Hugo as my generator. That transition was definitely not without quite a few bumps along the way. I first started to work on this transition about 4 years ago when it was necessary to generate quite a bit of Azure infrastructure to make it work, including some hacks to make default pages for folders work properly, so it never quite got done until today.

    Read more…
  • Finally!

    It’s been a long time in the making but I have finally transitioned this site to a static generated site being hosted on Azure. This past spring at Microsoft’s Build conference they released a new product in preview called Azure Static Web Apps that HUGELY simplified setting this up. It’s kind of funny because the previous weekend I had finally gotten back to starting to work on this transition and had gotten some build pipelines setup for all of the terraform for the infrastructure and now it turns out that absolutely none of that is needed anymore!

    Read more…
  • Dusting off the cobwebs a bit

    Over the past couple of years since I last added a new post to this blog I’ve been halfheartedly working on converting from WordPress to one of the modern static generators but luckily a recent involuntary, but somewhat welcome, change in employment has freed me up to finally (hopefully) make some progress on that front. With any luck I’ll have the site updated to new hosting and back-end by the end of the year.

    Read more…
  • Differing output from Where and Where-Object

    One of the lesser known features of PowerShell are some “magic” methods that get added to most (all?) collection objects that replace the slower Where-Object and ForEach-Object cmdlets with basically the same functionality. They’re considered magic because they aren’t well documented even years after they were introduced. (Thank goodness for bloggers) I’ve used ForEach quite a bit, but often forget about it’s Where counterpart and apparently had never actually done much with it until today when I ran into a weird issue where I couldn’t set the value of a property on a returned object.

    Read more…
  • Finding an item in an array of PSCustomObjects

    (This is mostly so I can find it again someday when I need it again.) When working with REST interfaces with PowerShell it’s pretty common to get JSON responses that have information that is returned as arrays of PSCustomObjects. If you need to update a property of one of those objects you can’t just do something simple like: PS C:\> ($result.objArray | Where-Object { $_.name -eq "whatever" }).value = "SomeNewValue" In order to set the value of a property you’re going to have to find the index of that particular object in the array and then manipulate it directly.

    Read more…
  • Standardized Tests for Standardized Parameters

    Something that you find when writing PowerShell modules to wrap API functions for external systems is that a lot of your functions tend to have a consistent subset of parameters that get used for things like credentials and specifying an endpoint. For example in the private TeamCity module that I maintain the parameter block for every function that interacts with a server has: [Parameter(Mandatory=$false)] [System.Management.Automation.PSCredential]$Credential = ( Get-Credential -Message "Please enter your credentials for the TeamCity server at $server"), [Parameter(Mandatory=$true)] [ValidateNotNull()] [string]$Server (Whether that is the best pattern I’m still not sure, but it’s beside the point of what I’m talking about here.

    Read more…
  • Reporting Pester Code Coverage Metrics to TeamCity

    As previously mentioned I’ve been doing a lot of work with PowerShell modules at work where I have recently gotten all the parts for a full continuous delivery pipeline working for those modules. A big section of that pipeline runs through TeamCity and while the existing ability to have Pester test results show up in the build results is really great, code coverage is slightly less obvious but in the end fairly simple.

    Read more…
  • Simple test coverage check for script modules

    I’ve been spending a lot of time at work writing PowerShell modules and as part of that effort we’ve been trying to make sure we’re doing at least some unit testing on those module functions (Using Pester of course!). Unfortunately we’ve had a few instances where a new function gets added to a module without any unit tests being added. We’ve structured our modules so that every function has it’s own source file and accompanying tests file and all of them are located in a \Functions\ folder in the project.

    Read more…
  • My Year in Soda: 2014

    I’ve been trying to remember to post my impressions of sodas that I try to Twitter through the year and figured I’d put together a Year In Review to collect all of the notes for posterity. This year’s high points: Phancy Sparkling Limeade and Empire Spruce Beer. Decent root beer with a distinct ginger beer flavor. Neither one nor the other, for better or worse. http://t.co/9XoOYjGgKv — Nathan Stohlmann (@Cavorter) February 26, 2014 Still not sure what to think.

    Read more…