Chapter 17. Creating a custom type extension
A few chapters back, we showed you how to create a custom formatting view for your tools’ output. In this chapter, we’re going to do something very similar by creating a type extension. Unlike views, which only affect the visual presentation of your output, a type extension can actually add functionality to objects you write to the pipeline.
17.1. The anatomy of an extension
Believe it or not, you’ve already seen type extensions in action. For example, run Get-Process | Get-Member, and look at the output:
TypeName: System.Diagnostics.Process Name MemberType Definition ---- ---------- ---------- Handles AliasProperty Handles = Handlecount Name AliasProperty Name = ProcessName NPM AliasProperty ...
Get Learn PowerShell Toolmaking in a Month of Lunches now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.