New Training: Configure Custom Formatting for PowerShell Objects
In this 6-video skill, CBT Nuggets trainer Trevor Sullivan covers the world of PowerShell object formatting. Learn how to create format data, how to configure list and table output, and how to include format data in your own custom PowerShell module. Watch this new Programming and Development training.
Watch the full course: Advanced PowerShell Automation
This training includes:
1.2 hours of training
You’ll learn these topics in this skill:
Why is PowerShell Object Formatting Important?
Constructing a PowerShell Formatting File
Colorizing Output with PowerShell Format Data
Including PowerShell Format Types in Modules
Modifying Third-Party Module Formatting
Call to Action
What is a PowerShell Formatting File?
A PowerShell formatting file is one that PowerShell uses to determine what properties of an object it displays and their formatting. The formatting is accomplished through defining views of objects. You can define any number of views for an object. What's more, you can define a single view for each object, a single view for multiple objects or multiple views of the same object.
You can display objects using four different types of views. A Table View lists object properties in multiple columns, with each row representing a returned object. A Wide View also lists object properties in multiple columns, but without labels or headers. A List View lists object properties in a single column, with each row representing a property. Finally, a Custom View allows you to customize the presentation of properties.
Formatting files do not determine what properties of an object that a pipeline returns. You can use any property of an object returned by a pipeline regardless of whether it displays.