Skip to main content
Version: 2.2.0

Convert-MtResultsToFlatObject

SYNOPSIS​

Convert Maester test results to a flattened object that can be exported to CSV or Excel.

SYNTAX​

FromFile (Default)​

Convert-MtResultsToFlatObject [-JsonFilePath] <String> [-ExportCsv] [-ExportExcel] [-CsvFilePath <String>]
[-ExcelFilePath <String>] [-Force] [-PassThru] [-ProgressAction <ActionPreference>] [<CommonParameters>]

XLSX​

Convert-MtResultsToFlatObject [-InputObject] <PSObject> [-JsonFilePath] <String> [-ExportCsv] [-ExportExcel]
[-ExcelFilePath <String>] [-Force] [-PassThru] [-ProgressAction <ActionPreference>] [<CommonParameters>]

CSV​

Convert-MtResultsToFlatObject [-InputObject] <PSObject> [-JsonFilePath] <String> [-ExportCsv] [-ExportExcel]
[-CsvFilePath <String>] [-Force] [-PassThru] [-ProgressAction <ActionPreference>] [<CommonParameters>]

FromInputObject​

Convert-MtResultsToFlatObject [-InputObject] <PSObject> [-ExportCsv] [-ExportExcel] [-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-MtResultsToFlatObject -JsonFilePath 'C:\path\to\results.json'

Convert the Maester test results in C:\path\to\results.json to a flattened object that is then returned to the pipeline.

EXAMPLE 2​

Convert-MtResultsToFlatObject -JsonFilePath 'C:\path\to\results.json' -ExportExcel

Convert the Maester test results in C:\path\to\results.json to a flattened object, and then export that object to an Excel file (C:\path\to\results.xlsx). Requires the ImportExcel module.

EXAMPLE 3​

Convert-MtResultsToFlatObject -JsonFilePath 'C:\path\to\results.json' -ExportCsv -CsvFilePath 'C:\path\to\results.csv'

Convert the Maester test results in C:\path\to\results.json to a flattened object, and then export that object to C:\path\to\results.csv.

PARAMETERS​

-InputObject​

Use the Maester test results from the pipeline or as an input object (JSON).

Type: PSObject
Parameter Sets: XLSX, CSV, FromInputObject
Aliases: MaesterResults

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, XLSX, CSV
Aliases:

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

-ExportCsv​

Export the flattened object to a CSV file.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-ExportExcel​

Export the flattened object to an Excel workbook using the ImportExcel module.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-CsvFilePath​

The path of the file to export CSV data to.

Type: String
Parameter Sets: FromFile, CSV, FromInputObject
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: FromFile, XLSX, FromInputObject
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​

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.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.

https://maester.dev/docs/commands/Convert-MtResultsToFlatObject