-Formattedswitch parameter. You may also use it to build a interactions with the user in other cases (e.g. to write extra information to the screen before prompting the user for a choice or input).
TIP: When debugging you should be aware that you can set
$DebugPreference = "Continue"to see this information on screen without entering a breakpoint prompt.
[CmdletBinding()]attribute enables the common
-Debugswitches which turn those streams on.
modulename.format.ps1xmlfile in the FormatsToProcess field of your module's PSD1 manifest, and define a
PSTypeNameon your objects, so that PowerShell will format your output the way you want, automatically.
[OutputType()]attribute the output type(s) of your scripts, functions or cmdlets (see about_Functions_OutputTypeAttribute for more information).
Out-Defaultseparately for each type of object to ensure that the outputs don't ever get mixed up by the formatter.