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

Partial Funcionality.

Getting this setup has been incredibly challenging. There’s not a lot of documentation and I can’t figure out how to initialize the collection database and get the initial catalogs. Know SMO and would like to help? Here’s the code I’ve got so far.


Migrates user SQL Data Collector collection sets. By default, all data collector objects are migrated.

The -CollectionSets parameter is autopopulated for command-line completion and can be used to copy only specific collection sets.

If the collection set already exists on the destination, it will be skipped unless -Force is specified. Force drops and recreates the collection set.


To copy all collection sets from sqlserver2014a to sqlcluster, using Windows credentials.


To copy all collection sets from sqlserver2014a to sqlcluster, using SQL credentials for sqlserver2014a and Windows credentials for sqlcluster.


To copy two Collection Sets, Server Activity and Table Usage Analysis, from sqlserver2014a to sqlserver2016c.



From PowerShell, execute Get-Help Copy-DbaSqlDataCollector -Detailed for more information on this function.

Source Code

Want to see the source code? View Copy-DbaSqlDataCollector.ps1 on GitHub

Related commands