kabtoffe.net - kabtoffe's blog

Description: The personal blog of Toffe Bergström also known online as kabtoffe.

Example domain paragraphs

In yesterday’s post I introduced a custom advanced function for changing property names on objects. I also showed you how to use Select-Object to do the same. Because the Select-Object cmdlet is probably more robust than my little function I decided to try and rewrite the function to use Select-Object under the hood.

Select-Object accepts an array of hashtable objects with two key/value pairs:

That string is exactly what we would feed Select-Object . To get it into actual PowerShell objects we need to feed it to Invoke-Expression . That gives us an array with two separate hashtables each with a N key with a string value and an E key with a script block value.