Book Image

Getting Started with Powershell

Book Image

Getting Started with Powershell

Overview of this book

Table of Contents (19 chapters)
Getting Started with PowerShell
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Next Steps
Index

When does formatting occur?


The first thing to understand about PowerShell formatting is that the host you are in always formats the output. Remember that the host is the application (for example, the PowerShell console or the ISE) that is running the PowerShell engine and executing the commands that you enter. Since we know that cmdlets always output objects, the presence of some kind of formatting system is clear when we look at the output of a cmdlet such as dir (or Get-ChildItem):

Somehow, certain properties are displayed and others are hidden. In this output, we can even see that the objects are grouped by a particular property (PSParentPath) by the display of Directory: C:\ at the top.

When the host executes a pipeline (and any line of code is a pipeline), it appends the Out-Default cmdlet to the end of the pipeline. The Out-Default cmdlet's job is to send the objects to the default formatter. The default formatter follows a set of rules to convert the output objects into special formatting...