Brian Drennan's Blog

Exploring curiosities in software.

Tag "PowerShell"

1 post

Loading PowerShell Args from JSON Configuration

I was working on a PowerShell script this afternoon, and found that I was passing the same parameters over and over again. As a developer, I’d normally just wrap calls to the desired function, and handle any necessary abstraction in my wrapper function for common parameters, but PowerShell has this wonderful language feature called Splatting that is really well suited to solving this problem in a really concise way. I also decided I wanted to lift some of this wonderful goodness to a JSON configuration file, because that enables some other really interesting scenarios. Let’s dig in!

PowerShell JSON