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

The dangers of formatting


The automatic formatting of objects makes the PowerShell experience much more comfortable. Seeing familiar looking output and commonly used properties is a great aid to productivity. However, formatting comes with a price. Simply put, formatted objects are not able to be used like the original objects were. For instance, once objects are formatted, there is no way to sort or filter them based on properties. Formatting can be compared with taking pictures of the objects. The picture looks similar to the objects, but are not the actual objects. The only thing that can be done with the formatted objects is to output them somewhere. As mentioned earlier, the Out-Default cmdlet sends them to the console. Additionally, the Out-File, Out-Printer, and Out-String cmdlets send the output (obviously) to a file, printer, and string.

Attempting to use the formatted objects in the same way that we've grown accustomed to using objects, fails miserably, as seen from the following...