commands

^

Get-DbaXESessionTemplate

Author Chrissy LeMaire (@cl), netnerds.net
Availability Windows, Linux, macOS

 

Want to see the source code for this command? Check out Get-DbaXESessionTemplate on GitHub.
Want to see the Bill Of Health for this command? Check out Get-DbaXESessionTemplate.

Synopsis

Parses Extended Event XML templates. Defaults to parsing templates in the dbatools template repository (/bin/XEtemplates/).

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/blob/master/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

Syntax

Get-DbaXESessionTemplate
    [[-Path] <String[]>]
    [[-Pattern] <String>]
    [[-Template] <String[]>]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

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.

Optional Parameters

-Path

The path to the template directory. Defaults to the dbatools template repository (/bin/XEtemplates/).

Alias
Required False
Pipeline false
Default Value "$script:PSModuleRoot\bin\XEtemplates"
-Pattern

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

Alias
Required False
Pipeline false
Default Value
-Template

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

Alias
Required False
Pipeline false
Default Value
-EnableException

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