To customize PowerShell 7 output, export an existing format definition or create a .Format.ps1xml file, edit its views, then load it with Update-FormatData. Use -PrependPath when your definition should take precedence over an existing view; use -AppendPath for an additional definition. Formatting changes how objects are displayed, not the objects or properties flowing through the pipeline.
What a PowerShell formatting file changes
A formatting file is XML that describes how PowerShell displays objects. Microsoft’s about_Format.ps1xml explains that “the formatting affects the display only.” A format view does not change an object’s properties or transform the data sent to the next pipeline command.
A file has a Configuration root and a ViewDefinitions container. Each view has a name, identifies object types or a selection set, and specifies a display control. It can also use properties or script blocks to supply displayed values.
PowerShell supports four view layouts:
- Table: displays selected fields in columns, useful for compact comparisons.
- List: displays fields as labeled entries, useful when objects have more detail than fits in a table.
- Wide: displays a single selected value across columns, favoring density over detail.
- Custom: uses a more specific control and layout.
PowerShell 6 and later define default views in source code as well as through formatting data. The Windows PowerShell 5.1 format-file collection is therefore not the complete source of PowerShell 7’s defaults. You can still add views for new types or define a replacement view for an existing type.
#1 Best Overall
- Book - powershell for sysadmins: workflow automation made easy
- Language: english
- Binding: paperback
Create a custom view from an existing definition
For a first customization, inspect and export a relevant existing definition. This example uses System.IO.FileInfo, the type commonly returned for file objects.
- Inspect the current formatting data:
Get-FormatData -TypeName System.IO.FileInfo - Export a starting file: create the destination directory if needed, then run:
Get-FormatData -TypeName System.IO.FileInfo | Export-FormatData -LiteralPath $HOME/Format/FileInfo.Format.ps1xml - Edit the XML: open
$HOME/Format/FileInfo.Format.ps1xmlin a text editor. Keep the view or views you need, and edit their displayed fields or layout. Make sure the view control suits how you intend to display the data. - Load the edited file: for a replacement view, run:
Update-FormatData -PrependPath $HOME/Format/FileInfo.Format.ps1xml - Test the output: run a command that produces the object type, such as
Get-Itemon a file path. If the file defines a named view and you want to select it explicitly, use that view name with the appropriate formatting cmdlet’s-Viewparameter.
For a new, non-conflicting view definition, load the file with -AppendPath instead. Microsoft documents Update-FormatData and its path parameters in the Update-FormatData cmdlet reference.
Choose precedence and view layout
The path parameter controls how a custom definition relates to existing formatting data. The view layout determines how much information appears and how it is arranged.
| Choice | Use it when | Effect |
|---|---|---|
-PrependPath |
You intend your definition to take precedence over an existing view. | Loads the file ahead of existing definitions, giving the custom definition precedence. |
-AppendPath |
You are adding a definition that does not need to take precedence over an existing view. | Loads the file after existing definitions. |
| Table | You want a compact view of selected fields. | Shows data in columns. |
| List | You want more room for labeled fields. | Shows properties as entries. |
| Wide | You need a dense display of one value. | Arranges that value across columns. |
| Custom | You need a tailored display control. | Uses the control and layout defined for that view. |
A custom view may appear not to override the default if it was appended rather than prepended, if the view does not target the type being formatted, or if another view is explicitly selected. Check the view’s type selection and the command’s formatting behavior before changing the XML again.
Rank #3
Load the file for this session or future sessions
Update-FormatData reloads formatting data into the current session; it does not require restarting PowerShell. A file loaded this way remains in that session, and PowerShell does not provide a way to remove loaded format data there. Start a new session to return to the original formatting data.
To load the file automatically in future sessions, add the command to a PowerShell profile. Find the directory containing the current profile with:
Rank #4
Split-Path -Path $PROFILE -Parent
Open the profile file in that directory and add the appropriate Update-FormatData command, using -PrependPath or -AppendPath as needed. Profile paths can differ by host and user, so use the value of $PROFILE in the environment where you want the customization.
Troubleshoot a view that does not appear
When a file fails to load or PowerShell does not bind the expected view to an object, Microsoft recommends tracing format-file loading and view binding with Trace-Command:
Best Value
Trace-Command -Name FormatFileLoading,FormatViewBinding -Expression { Get-Item . } -PSHost
Replace Get-Item . with the command that produces the object you are troubleshooting. Use the trace to distinguish a file-loading problem from a mismatch between the view and the object type or selected view.
- Confirm that the file path passed to
Update-FormatDatais correct and that the XML is valid. - Check that the view targets the type of object actually being formatted.
- Use
-PrependPathif the intent is to take precedence over an existing view. - Check whether the command explicitly chooses a different named view or formatting control.
- If you need to undo a loaded definition, open a new PowerShell session; loaded format data cannot be removed from the current one.
Keep built-in format files intact
PowerShell’s installation directory is available as $PSHOME. Built-in files such as FileSystem.Format.ps1xml can be useful examples, but do not edit them directly. Keep custom formatting files in a separate location so that your changes remain distinct from the installed reference files. Microsoft also documents digitally signing formatting files as a way to protect users who load them; see about_Format.ps1xml.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

