Convert-MtResultsToFlatObject
SYNOPSIS
Convert Maester test results to a flattened object that can be exported to CSV or Excel.
SYNTAX
FromResults (Default)
Convert-MtResultsToFlatObject [-MaesterResults] <PSObject> [-CsvFilePath <String>] [-ExcelFilePath <String>]
[-Force] [-PassThru] [-ProgressAction <ActionPreference>] [<CommonParameters>]
FromFile
Convert-MtResultsToFlatObject [-JsonFilePath] <String> [-CsvFilePath <String>] [-ExcelFilePath <String>]
[-Force] [-PassThru] [-ProgressAction <ActionPreference>] [<CommonParameters>]
DESCRIPTION
Convert Maester test results to a flattened object that can be exported to CSV or Excel. This function exports the data to a CSV file by default, but can also export to an Excel file if the ImportExcel module is installed.
The function also supports reading Maester test results from a JSON file and exporting the flattened object to a CSV.
EXAMPLES
EXAMPLE 1
Convert-MtJsonResultsToFlatObject -JsonFilePath 'C:\path\to\results.json'
Convert the Maester test results from JSON to a flattened object that is returned to the pipeline.
EXAMPLE 2
Convert-MtJsonResultsToFlatObject -JsonFilePath 'C:\path\to\results.json' -ExportExcel
Convert the Maester test results from JSON to a flattened object and then export that object to an Excel file.
PARAMETERS
-MaesterResults
The Maester test results returned from Invoke-Maester -PassThru | Convert-MtResultsToFlatObject
.
Type: PSObject
Parameter Sets: FromResults
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-JsonFilePath
The path of the file containing the Maester test results in JSON format.
Type: String
Parameter Sets: FromFile
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-CsvFilePath
The path of the file to export CSV data to.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: "$($JsonFilePath -replace '\.json$', '.csv')"
Accept pipeline input: False
Accept wildcard characters: False
-ExcelFilePath
The path of the file to export an Excel worksheet to.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: "$($JsonFilePath -replace '\.json$', '.xlsx')"
Accept pipeline input: False
Accept wildcard characters: False
-Force
Force the export to a CSV/XLSX file even if the file already exists.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-PassThru
Return the flattened object to the pipeline.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ProgressAction
{{ Fill ProgressAction Description }}
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.Collections.Generic.List[PSObject]
NOTES
Due to limitations in CSV files and Excel cells, the ResultDetails property is limited to 30000 characters. If the test result details are longer than this, that section will be truncated and a notification will be included in its place. This is most likely to happen when details about a large number of users is included in the result details. The full details are still available in the JSON file and the HTML report.
RELATED LINKS
https://maester.dev/docs/commands/Convert-MtResultsToFlatObject