Skip to main content
Version: 3.0.0-preview

Add-MtReportAttachment

SYNOPSIS​

Embeds an HTML report from another tool in the Maester HTML report, opened with one click.

SYNTAX​

Path (Default)​

Add-MtReportAttachment -Name <String> -Path <String> [-ProgressAction <ActionPreference>] [<CommonParameters>]

Content​

Add-MtReportAttachment -Name <String> -Content <String> [-ProgressAction <ActionPreference>]
[<CommonParameters>]

DESCRIPTION​

Call this from a test, an instance source or a pack when the tool it runs writes its own single-file HTML report (for example the Microsoft Zero Trust Assessment). The file is read at once, so the tool's output folder can be deleted afterwards.

The HTML report shows a button for each attachment on the overview page, and on the result of the test that added it. The button shows the attached report inside the Maester report, beside its navigation, with an option to open it in a new browser tab. The report is stored compressed (gzip, then Base64), so a 10 MB report adds about 2 MB to the Maester report.

Attachments are kept only in the HTML report and the results that Invoke-Maester -PassThru returns. The JSON results file lists each attachment's name and size without its content. The HTML report leaves attachments out when -RedactUserIdentity is used, because Maester cannot redact another tool's report.

The attached page runs in a sandboxed frame, with its scripts in an origin of their own, so it cannot read or change the Maester report or its data. Adding a second attachment with the same name from the same test replaces the first.

EXAMPLES​

EXAMPLE 1​

Add-MtReportAttachment -Name 'Zero Trust Assessment' -Path ./zt/ZeroTrustAssessmentReport.html

Embeds the Zero Trust Assessment report in the Maester report of this run.

EXAMPLE 2​

Add-MtReportAttachment -Name 'Tenant inventory' -Content $html

Embeds an HTML page built in memory.

PARAMETERS​

-Name​

The label of the button that opens the attachment, for example 'Zero Trust Assessment'.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Path​

Path of a single-file HTML report to embed.

Type: String
Parameter Sets: Path
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Content​

The HTML to embed, when it is not in a file.

Type: String
Parameter Sets: Content
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-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: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

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.

INPUTS​

OUTPUTS​

System.Void​

NOTES​

https://maester.dev/docs/commands/Add-MtReportAttachment