Write-MtTestOutput
Synopsis
Section titled “Synopsis”Shows the lines a long-running test writes while it works, live in the Maester console.
Syntax
Section titled “Syntax”Line (Default)
Section titled “Line (Default)”Write-MtTestOutput [[-InputObject] <Object>] [-Title <String>] [-Progress] [-ProgressAction <ActionPreference>] [<CommonParameters>]Complete
Section titled “Complete”Write-MtTestOutput [-Complete] [-ProgressAction <ActionPreference>] [<CommonParameters>]Description
Section titled “Description”For a test, or the instance source of a family, that runs a tool for a long time (for example a command in another PowerShell process) and wants the person running Maester to see that tool’s log as it runs.
While the full-screen dashboard of an interactive run has the screen, nothing else can write to the console. The lines go into a box in the main column of the dashboard, which scrolls as they come in. Otherwise (the compact layout, CI and redirected output) each line is written to the host as it comes, indented and dimmed, and a line of -Progress at most every ten seconds. The lines go to the host itself, not to the information stream: Write-Host in a test is kept and shown only when the test has finished.
The box opens with the first line, or with -Title, and closes with -Complete. Maester closes it when the test or the instance source finishes.
A line that starts with ##maester[progress] followed by a JSON object, or with ##maester[error] followed by text, is not shown as a line: it sets the progress at the top of the box, or adds an error to it, as Write-MtTestProgress does. A tool in another process, in any language, reports its progress that way by writing those lines to its output.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”&1 | Write-MtTestOutput -Title 'Collecting the tenant data'Write-MtTestOutput -CompleteShows the output of a script that runs in another PowerShell process in the console while it runs.
Example 2
Section titled “Example 2”'##maester[progress] {"stage":"Exporting","stageNumber":1,"stageCount":3,"completed":4,"total":9}' | Write-MtTestOutputSets the progress at the top of the box, as Write-MtTestProgress -Stage Exporting -StageNumber 1 -StageCount 3 -Completed 4 -Total 9 does.
Parameters
Section titled “Parameters”-InputObject
Section titled “-InputObject”A line to show. Line breaks start new lines. Escape sequences, emoji and other control characters are removed.
Type: ObjectParameter Sets: LineAliases:
Required: FalsePosition: 1Default value: NoneAccept pipeline input: True (ByValue)Accept wildcard characters: False-Title
Section titled “-Title”The title of the box. A new title starts the box again, empty.
Type: StringParameter Sets: LineAliases:
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False-Progress
Section titled “-Progress”The line is a status that changes (such as “Completed: 12 / 300”). In the dashboard it is pinned at the bottom of the box, under the lines that scroll, and the next line of progress replaces it.
Type: SwitchParameterParameter Sets: LineAliases:
Required: FalsePosition: NamedDefault value: FalseAccept pipeline input: FalseAccept wildcard characters: False-Complete
Section titled “-Complete”Closes the box.
Type: SwitchParameterParameter Sets: CompleteAliases:
Required: TruePosition: NamedDefault value: FalseAccept pipeline input: FalseAccept wildcard characters: False-ProgressAction
Section titled “-ProgressAction”Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by Write-Progress.
Type: ActionPreferenceParameter Sets: (All)Aliases: proga
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: FalseCommonParameters
Section titled “CommonParameters”This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.