A default display property set chooses which properties PowerShell shows when it formats an object. For custom type behavior, declare it in a types.ps1xml file. section 11.2
To customize a type’s default output:
- Declare the type and its DefaultDisplayPropertySet under PSStandardMembers. section 11.2
- List the properties to display, such as Scheme, Host, Port, AbsoluteUri, and IsFile. section 11.2
- Load the file with Update-TypeData, then run the object-producing command again. section 11.2
Formatting a URI
After loading the type data, [Uri]"https://github.com" displays only Scheme, Host, Port, AbsoluteUri, and IsFile instead of the full property list. section 11.2
<?xml version="1.0" encoding="utf-8" ?>
<Types>
<Type>
<Name>System.Uri</Name>
<Members>
<MemberSet>
<Name>PSStandardMembers</Name>
<Members>
<PropertySet>
<Name>DefaultDisplayPropertySet</Name>
<ReferencedProperties>
<Name>Scheme</Name>
<Name>Host</Name>
<Name>Port</Name>
<Name>AbsoluteUri</Name>
<Name>IsFile</Name>
</ReferencedProperties>
</PropertySet>
</Members>
</MemberSet>
</Members>
</Type>
</Types>
Inspect the XML structure used to declare DefaultDisplayPropertySet for System.Uri. section 11.2
