Convert-MtResultsToFlatObject
SYNOPSIS
Section titled “SYNOPSIS”Convert Maester test results to a flattened object that can be exported to CSV or Excel.
SYNTAX
Section titled “SYNTAX”FromFile (Default)
Section titled “FromFile (Default)”Convert-MtResultsToFlatObject [-JsonFilePath] <String> [-ExportCsv] [-ExportExcel] [-CsvFilePath <String>] [-ExcelFilePath <String>] [-Force] [-PassThru] [-ProgressAction <ActionPreference>] [<CommonParameters>]Convert-MtResultsToFlatObject [-InputObject] <PSObject> [-JsonFilePath] <String> [-ExportCsv] [-ExportExcel] [-ExcelFilePath <String>] [-Force] [-PassThru] [-ProgressAction <ActionPreference>] [<CommonParameters>]Convert-MtResultsToFlatObject [-InputObject] <PSObject> [-JsonFilePath] <String> [-ExportCsv] [-ExportExcel] [-CsvFilePath <String>] [-Force] [-PassThru] [-ProgressAction <ActionPreference>] [<CommonParameters>]FromInputObject
Section titled “FromInputObject”Convert-MtResultsToFlatObject [-InputObject] <PSObject> [-ExportCsv] [-ExportExcel] [-CsvFilePath <String>] [-ExcelFilePath <String>] [-Force] [-PassThru] [-ProgressAction <ActionPreference>] [<CommonParameters>]DESCRIPTION
Section titled “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
Section titled “EXAMPLES”EXAMPLE 1
Section titled “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
Section titled “EXAMPLE 2”Convert-MtResultsToFlatObject -JsonFilePath 'C:\path\to\results.json' -ExportExcelConvert 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
Section titled “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
Section titled “PARAMETERS”-InputObject
Section titled “-InputObject”Use the Maester test results from the pipeline or as an input object (JSON).
Type: PSObjectParameter Sets: XLSX, CSV, FromInputObjectAliases: MaesterResults
Required: TruePosition: 1Default value: NoneAccept pipeline input: True (ByValue)Accept wildcard characters: False-JsonFilePath
Section titled “-JsonFilePath”The path of the file containing the Maester test results in JSON format.
Type: StringParameter Sets: FromFile, XLSX, CSVAliases:
Required: TruePosition: 1Default value: NoneAccept pipeline input: FalseAccept wildcard characters: False-ExportCsv
Section titled “-ExportCsv”Export the flattened object to a CSV file.
Type: SwitchParameterParameter Sets: (All)Aliases:
Required: FalsePosition: NamedDefault value: FalseAccept pipeline input: FalseAccept wildcard characters: False-ExportExcel
Section titled “-ExportExcel”Export the flattened object to an Excel workbook using the ImportExcel module.
Type: SwitchParameterParameter Sets: (All)Aliases:
Required: FalsePosition: NamedDefault value: FalseAccept pipeline input: FalseAccept wildcard characters: False-CsvFilePath
Section titled “-CsvFilePath”The path of the file to export CSV data to.
Type: StringParameter Sets: FromFile, CSV, FromInputObjectAliases:
Required: FalsePosition: NamedDefault value: "$($JsonFilePath -replace '\.json$', '.csv')"Accept pipeline input: FalseAccept wildcard characters: False-ExcelFilePath
Section titled “-ExcelFilePath”The path of the file to export an Excel worksheet to.
Type: StringParameter Sets: FromFile, XLSX, FromInputObjectAliases:
Required: FalsePosition: NamedDefault value: "$($JsonFilePath -replace '\.json$', '.xlsx')"Accept pipeline input: FalseAccept wildcard characters: False-Force
Section titled “-Force”Force the export to a CSV/XLSX file even if the file already exists.
Type: SwitchParameterParameter Sets: (All)Aliases:
Required: FalsePosition: NamedDefault value: FalseAccept pipeline input: FalseAccept wildcard characters: False-PassThru
Section titled “-PassThru”Return the flattened object to the pipeline.
Type: SwitchParameterParameter Sets: (All)Aliases:
Required: FalsePosition: 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.
INPUTS
Section titled “INPUTS”OUTPUTS
Section titled “OUTPUTS”System.Collections.Generic.List[PSObject]
Section titled “System.Collections.Generic.List[PSObject]”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
Section titled “RELATED LINKS”https://maester.dev/docs/commands/Convert-MtResultsToFlatObject