Monday, 28 November 2016

Splat! Ahhhaaaa!!!

Ever had a situation where you need to execute a cmdlet in PowerShell but also needed to pass in different parameters depending on what parameters had been passed to your code? So the first thing you try is using a whole lot of if else statements...but that is butt ugly and verbose right?

Well, PowerShell uses a technique called Splatting to resolve this. Here is a simple enough post to explain it: https://ramblingcookiemonster.wordpress.com/2014/12/01/powershell-splatting-build-parameters-dynamically/

Thanks rambling cookie monster!

1 comment:

  1. So coming off several posts on DevOps and how its practices combined with agile development can lead to an improved execution, I thought to share some incites on how to recognize and improve IT culture.


    devops jobs in hyderabad

    ReplyDelete