< Back
Export-DbaDiagnosticQuery
Post
NAME Export-DbaDiagnosticQuery
SYNOPSIS
Export-DbaDiagnosticQuery can convert output generated by Invoke-DbaDiagnosticQuery to CSV or Excel
SYNTAX
Export-DbaDiagnosticQuery [-InputObject] <System.Object[]> [[-ConvertTo] <String>] [[-Path] <System.IO.FileInfo>]
[[-Suffix] <String>] [-NoPlanExport <Switch>] [-NoQueryExport <Switch>] [-EnableException <Switch>]
[<CommonParameters>]
DESCRIPTION
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.
PARAMETERS
-ConvertTo [<String>]
Specifies the output type. Valid choices are Excel and CSV. CSV is the default.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-EnableException [<Switch>]
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.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-InputObject [<System.Object[]>]
Specifies the objects to convert
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-NoPlanExport [<Switch>]
Use this switch to suppress exporting of .sqlplan files
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-NoQueryExport [<Switch>]
Use this switch to suppress exporting of .sql files
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Path [<System.IO.FileInfo>]
Specifies the path to the output files.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Suffix [<String>]
Suffix for the filename. It's datetime by default.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
Tags: Community, GlennBerry
Author: Andre Kamman (@AndreKamman), http://clouddba.io
Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Invoke-DbaDiagnosticQuery -SqlInstance sql2016 | Export-DbaDiagnosticQuery -Path c:\\temp
Converts output from Invoke-DbaDiagnosticQuery to multiple CSV files
-------------------------- EXAMPLE 2 --------------------------
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
RELATED LINKS
https://dbatools.io/Export-DbaDiagnosticQuery
SYNOPSIS
Export-DbaDiagnosticQuery can convert output generated by Invoke-DbaDiagnosticQuery to CSV or Excel
SYNTAX
Export-DbaDiagnosticQuery [-InputObject] <System.Object[]> [[-ConvertTo] <String>] [[-Path] <System.IO.FileInfo>]
[[-Suffix] <String>] [-NoPlanExport <Switch>] [-NoQueryExport <Switch>] [-EnableException <Switch>]
[<CommonParameters>]
DESCRIPTION
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.
PARAMETERS
-ConvertTo [<String>]
Specifies the output type. Valid choices are Excel and CSV. CSV is the default.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-EnableException [<Switch>]
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.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-InputObject [<System.Object[]>]
Specifies the objects to convert
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-NoPlanExport [<Switch>]
Use this switch to suppress exporting of .sqlplan files
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-NoQueryExport [<Switch>]
Use this switch to suppress exporting of .sql files
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Path [<System.IO.FileInfo>]
Specifies the path to the output files.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Suffix [<String>]
Suffix for the filename. It's datetime by default.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
Tags: Community, GlennBerry
Author: Andre Kamman (@AndreKamman), http://clouddba.io
Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Invoke-DbaDiagnosticQuery -SqlInstance sql2016 | Export-DbaDiagnosticQuery -Path c:\\temp
Converts output from Invoke-DbaDiagnosticQuery to multiple CSV files
-------------------------- EXAMPLE 2 --------------------------
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
RELATED LINKS
https://dbatools.io/Export-DbaDiagnosticQuery