Sometimes you may want to tag results returned by a cmdlet with some extra information, such as a reference to some PC name or a timestamp. You can use Add-Member to tag a note property to the result.
This line gets all services and adds two new columns: the PC name, and the date and time the results were returned:
$result = Get-Service |
Add-Member NoteProperty Computer $env:computername -pass |
Add-Member NoteProperty Timestamp (Get-Date) -pass
$result | Select-Object Status, Name, Computer, Time*
Add-Member NoteProperty Computer $env:computername -pass |
Add-Member NoteProperty Timestamp (Get-Date) -pass
$result | Select-Object Status, Name, Computer, Time*
Note that you will only see the new columns if you explicitly ask Select-Object to show them.