Rename a custom object and add a default output for the new type
$Object = [PSCustomObject]@{
Id = "1"
Name = "VM01"
Description = "A virtual machine"
Location = "UK"
IPAddress = "10.0.0.1"
}
$Object.PSObject.TypeNames.Insert(0, "Test.Type")
Update-TypeData -TypeName "Test.Type" -DefaultDisplayPropertySet "Id", "Name", "Description" -Force
$Object
# Id Name Description
# -- ---- -----------
# 1 VM01 A virtual machine
# Or run $Object | Select * to see all properties
# Id : 1
# Name : VM01
# Description : A virtual machine
# Location : UK
# IPAddress : 10.0.0.1