powershell

  2019-01-31


I’ve become a big believer in the past few years in using PowerShell for a whole passel of odd jobs, particularly since it was open sourced. At the time of the strategic shift for the language, some of the principal promoters made the argument that PowerShell was well suited to cloud workflows, because of its native handling of objects. My experience is that this is largely born out — native types for CSV, JSON, and XML along with easy file handling consistent with its origins as an interactive shell mean that it’s very easy to work through all sorts of data slinging. I often use perl, too, but it’s very convenient in PowerShell that I can easily push statements or expressions into the shell, see the results, and iterate or introspect over the returned objects. Makes it straightforward to progressively build out a script.

PowerShell does have some quirky semantics that took me a while to get used to like the function return values (everything that is not cast to void or captured by a variable is returned). In addition, some of its power comes from its native ability to handle .NET classes, but the syntax for working with them is different than how they’re documented (almost always in C Sharp ).

I’ve found stackoverflow invaluable for looking up some of the odder pieces of behaviour that I’ve gotten hung up on. When that fails, usually I can figure it out or come at the probem from a different angle. And it’s been worth all the effort; over time, I’ve gotten a lot faster at working out a complex script. Now everything I script is one less thing that I have to do day to day.