Last active
July 26, 2016 19:26
-
-
Save chelnak/ead612feefe33f059552db4a2cf48a9c to your computer and use it in GitHub Desktop.
Rename a custom object and add a default output for the new type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment