Monday, March 27, 2017

The lazy man’s Select-Object Expression

I have known the Select-Object Expression pattern since I started with PowerShell. Where the syntax is this:

select-object @{Name="Property1"; Expression={$_.PropertyObject.Property1}}

But a new PowerShell tip I lean this week is a syntax:

select-object {$_.PropertyObject.Property1}

The big difference is the headline on the column. In the first example, I control the column headline and the second example the headline will be:

$_.PropertyObject.Property1
-----------------------------------------

No comments:

Post a Comment