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


Imports a new Performance Monitor Data Collector Set Template either from the dbatools repository or a file you specify.
When importing data collector sets from the local instance, Run As Admin is required.

Note: The included counters will be added for all SQL instances on the machine by default.
For specific instances in addition to the default, use -Instance.

See [MSDN[(https://msdn.microsoft.com/en-us/library/windows/desktop/aa371952 for more information).




Creates a new data collector set named ‘Long Running Query’ from the dbatools repository on the SQL Server sql2017.

Import-DbaPfDataCollectorSetTemplate -SqlInstance sql2017 -Template ‘Long Running Query’

Creates a new data collector set named “New Long Running Query” using the ‘Long Running Query’ template. Forces a confirmation if the template exists.

Import-DbaPfDataCollectorSetTemplate -SqlInstance sql2017 -Template ‘Long Running Query’ -DisplayName ‘New Long running query’ -Confirm

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

Get-DbaPfDataCollectorSet -SqlInstance sql2017 -Session db_ola_health | Remove-DbaPfDataCollectorSet
Import-DbaPfDataCollectorSetTemplate -SqlInstance sql2017 -Template db_ola_health | Start-DbaPfDataCollectorSet

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

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

Creates a new data collector set named ‘Long Running Query’ from the dbatools repository on the SQL Server sql2017 for both the default and the SHAREPOINT instance.

If you’d like to remove counters for the default instance, use Remove-DbaPfDataCollectorCounter.

Import-DbaPfDataCollectorSetTemplate -SqlInstance sql2017 -Template ‘Long Running Query’ -Instance SHAREPOINT


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


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

Source Code

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

Related commands