< Back

Get-DbaXESessionTemplate

Mon Jan 13, 2020 11:56 am

NAME Get-DbaXESessionTemplate



SYNOPSIS

Parses Extended Event XML templates. Defaults to parsing templates in the dbatools template repository

(\\bin\\xetemplates\\).





SYNTAX

Get-DbaXESessionTemplate [[-Path] <System.String[]>] [[-Pattern] <String>] [[-Template] <System.String[]>]

[-EnableException <Switch>] [<CommonParameters>]





DESCRIPTION

Parses Extended Event XML templates. Defaults to parsing templates in the dbatools template repository

(\\bin\\xetemplates\\).



The default repository contains templates from:



Microsoft's Templates that come with SSMS



Jes Borland's "Everyday Extended Events" presentation and GitHub repository

(https://github.com/grrlgeek/extended-events)



Christian Grafe (@ChrGraefe) XE Repo: https://github.com/chrgraefe/sqlscripts ... XE-Events/



Erin Stellato's Blog: https://www.sqlskills.com/blogs/erin/



Some profile templates converted using:



sp_SQLskills_ConvertTraceToExtendedEvents.sql



Jonathan M. Kehayias, SQLskills.com



http://sqlskills.com/blogs/jonathan





PARAMETERS

-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



-Path [<System.String[]>]

The path to the template directory. Defaults to the dbatools template repository (\\bin\\xetemplates\\).



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Pattern [<String>]

Specify a pattern for filtering. Alternatively, you can use Out-GridView -Passthru to select objects and pipe

them to Import-DbaXESessionTemplate



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Template [<System.String[]>]

Specifies one or more of the templates provided by dbatools. Press tab to cycle through the list of options.



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: ExtendedEvent, XE, XEvent

Author: Chrissy LeMaire (@cl), netnerds.net



Website: https://dbatools.io

Copyright: (c) 2018 by dbatools, licensed under MIT

License: MIT https://opensource.org/licenses/MIT



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Get-DbaXESessionTemplate



Returns information about all the templates in the local dbatools repository.

-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-DbaXESessionTemplate | Out-GridView -PassThru | Import-DbaXESessionTemplate -SqlInstance sql2017 |

Start-DbaXESession



Allows you to select a Session template, then import it to the specified instance and start the session.

-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Get-DbaXESessionTemplate -Path "$home\\Documents\\SQL Server Management Studio\\Templates\\XEventTemplates"



Returns information about all the templates in your local XEventTemplates repository.

-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Get-DbaXESessionTemplate -Pattern duration



Returns information about all the templates that match the word "duration" in the title, category or body.

-------------------------- EXAMPLE 5 --------------------------



PS C:\\>Get-DbaXESessionTemplate | Select-Object *



Returns more information about the template, including the full path/filename.



RELATED LINKS

https://dbatools.io/Get-DbaXESessionTemplate