We’ve seen the Select-Object synthetic property method and the Add-Member -name AddNoteProperty method, but here’s probably the most straightforward way to output object data.
$object = $true | Select ComputerName, Path, ContentCount;
$object.ContentCount = (Get-ChildItem).Count;
This works because the first line creates an object with the NoteProperty properties we need. When we Select-Object on properties that don’t exist, the cmdlet will create them and set the value to $null. The rest of the script is just a matter of populating the properties, then the last line outputs it.