You can use Select-Object to add new properties to an existing object. In PowerShell v.2, Select-Object accepts a wildcard, which in turn adds all existing properties. Why would that be useful? Have a look:
Dir | Select-Object *, Age |
Foreach-Object { $_.Age=(new-timespan $_.LastWriteTime).Days$_ } |
Format-Table Name, Age
Foreach-Object { $_.Age=(new-timespan $_.LastWriteTime).Days$_ } |
Format-Table Name, Age
Dir | Select-Object *, Age |
Foreach-Object { $_.Age=(new-timespan $_.LastWriteTime).Days$_ } |
Format-Table Name, Age
Foreach-Object { $_.Age=(new-timespan $_.LastWriteTime).Days$_ } |
Format-Table Name, Age