Use a customized view to format PowerShell output.

      Format-Custom [[-property] Object[]] [-inputObject psobject]
         [-view string] [-groupBy Object] [-force] [-expand string]
            [-displayError] [-showError]
               [-depth int] [CommonParameters]

   -property Object[]
       The object properties to display (in order)
       Wildcards are permitted.
       You cannot use -Property and -View in the same command.

   -inputObject psobject
       The objects to format. A variable, command or expression that gets the objects.
       Use for flat collections, nested collections may need to be unwrapped and passed through the pipe.

   -view string
       The name of an alternate format or "view." 
       The DotNetTypes.format.ps1xml formatting file defines these views.

   -groupBy Object
       Format the output in groups based on a shared property or value.

       Override restrictions that prevent the command from succeeding, 
       without compromising security. Force will override read-only
       attributes but will not change file permissions.

   -expand string
       Where string is either "EnumOnly" (the default), "CoreOnly" or "Both"
       'CoreOnly' will format and display properties of the collection object itself, 
       while 'emumOnly' will enumerate and display the object properties. 
       (designed around the ICollection (System.Collections) interface.)

       Display errors at the command line.

       Send errors through the pipeline.

   -depth int
       The number of columns in the display.

Standard Aliases for Format-Custom: fc

The format- cmdlets emit specialized formatting directives, so they do not ouptut a standard PowerShell object, for this reason they should always be the right-most cmdlet in the pipeline. If you need to apply a WHERE filter, do that before any formatting.

The value of -Property can be a new calculated property. To create a calculated property, use a hash table. Valid keys are:

-- Expression string or script block
-- Depth int32

If the Format-Custom command does not include -View, a default custom view will be used to format the data.


List the Winlogon process using a custom view called MyCustomView :

PS C:\> get-process Winlogon | format-custom -view MyCustomView

“You must do the thing you think you cannot do” ~ Eleanor Roosevelt

Related PowerShell Cmdlets

format-table - Format the output as a table.
format-wide - Format objects as a table of their properties.
out-file - Send command output to a file.

Copyright © 1999-2024
Some rights reserved