dbatools is a free PowerShell module with over 300 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Import-DbaXESessionTemplate

Imports a new XESession XML Template either from our repo or a file you specify.

Screenshots

dbatools-Import-DbaXESessionTemplate

Examples

Creates a new XESession named db_query_wait_stats from our repo to the SQL Server sql2017.

Import-DbaXESessionTemplate -SqlInstance sql2017 -Template db_query_wait_stats

Creates a new XESession named “Query Wait Stats” using the db_query_wait_stats template.

Import-DbaXESessionTemplate -SqlInstance sql2017 -Template db_query_wait_stats -Name “Query Wait Stats”

Imports a session if it exists then recreates it using a template.

Get-DbaXESession -SqlInstance sql2017 -Session db_ola_health | Remove-DbaXESession
Import-DbaXESessionTemplate -SqlInstance sql2017 -Template db_ola_health | Start-DbaXESession

Allows you to select a Session template then import to an instance named sql2017.

Get-DbaXESessionTemplate | Out-GridView -PassThru | Import-DbaXESessionTemplate -SqlInstance sql2017

Author

This command was created by Chrissy LeMaire. You can find Chrissy on Twitter.

Get-Help

From PowerShell, execute Get-Help Import-DbaXESessionTemplate -Detailed for more information on this function.

Source Code

Want to see the source code? View Import-DbaXESessionTemplate.ps1 on GitHub
 

Related commands