Author | Andre Kamman (@AndreKamman), clouddba.io |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Export-DbaDiagnosticQuery on GitHub.
Want to see the Bill Of Health for this command? Check out Export-DbaDiagnosticQuery.
Export-DbaDiagnosticQuery can convert output generated by Invoke-DbaDiagnosticQuery to CSV or Excel
The default output format of Invoke-DbaDiagnosticQuery is a custom object. It can also output to CSV and Excel.
However, CSV output can generate a lot of files and Excel output depends on the ImportExcel module by Doug Finke (https://github.com/dfinke/ImportExcel)
Export-DbaDiagnosticQuery can be used to convert from the default export type to the other available export types.
Export-DbaDiagnosticQuery
[-InputObject] <Object[]>
[[-ConvertTo] <String>]
[[-Path] <FileInfo>]
[[-Suffix] <String>]
[-NoPlanExport]
[-NoQueryExport]
[-EnableException]
[<CommonParameters>]
PS C:\> Invoke-DbaDiagnosticQuery -SqlInstance sql2016 | Export-DbaDiagnosticQuery -Path c:\temp
Converts output from Invoke-DbaDiagnosticQuery to multiple CSV files
PS C:\> $output = Invoke-DbaDiagnosticQuery -SqlInstance sql2016
PS C:\> Export-DbaDiagnosticQuery -InputObject $output -ConvertTo Excel
Converts output from Invoke-DbaDiagnosticQuery to Excel worksheet(s) in the Documents folder
Specifies the objects to convert
Alias | |
Required | True |
Pipeline | true (ByValue) |
Default Value |
Specifies the output type. Valid choices are Excel and CSV. CSV is the default.
Alias | |
Required | False |
Pipeline | false |
Default Value | Csv |
Accepted Values | Excel,Csv |
Specifies the path to the output files.
Alias | |
Required | False |
Pipeline | false |
Default Value | (Get-DbatoolsConfigValue -FullName 'Path.DbatoolsExport') |
Suffix for the filename. It's datetime by default.
Alias | |
Required | False |
Pipeline | false |
Default Value | "$(Get-Date -format 'yyyyMMddHHmmssms')" |
Use this switch to suppress exporting of .sqlplan files
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Use this switch to suppress exporting of .sql files
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |