Create and load a custom view, like a table or a list, that shows what you want.
Create and load a type extension that defines a DefaultDisplayPropertySet. Only those properties will display by default.
These are usually easiest to do if the code that creates your custom object is in a module. You can use the module's manifest to also load the custom view and/or custom type extension as part of the module, so that it all happens transparently.
"PowerShell In Depth" covers all of this. You can also review the help for Update-FormatData and Update-TypeData, although they do not completely document the XML syntax. In the $pshome folder you will find the .ps1xml file (type extensions) and .format.ps1xml files (format views) that PowerShell ships with. I've used those as examples in the past.
The topic ‘Showing selected properties in a new object?’ is closed to new replies.