Use a customized view to format powershell output.
Syntax Format-Custom [[-property] Object] [-inputObject psobject] [-view string] [-groupBy Object] [-force] [-expand string] [-displayError] [-showError] [-depth int] [CommonParameters] Key -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) -view string The name of an alternate format or "view." -groupBy Object Format the output in groups based on a shared property or value. -force 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.) -displayError Display errors at the command line. -showError Send errors through the pipeline. -depth int The number of columns in the display. CommonParameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable, -OutBuffer -OutVariable.
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
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 SS64.com 1999-2013
Some rights reserved