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


This Response type can be used to replay execution related events to a target SQL Server instance. The events that you can replay are of the type sql_batch_completed and rpc_completed: all other events are ignored.




Replays events from sql2016 on sql2017 in the planning database. Returns a PowerShell job object.
To see a list of all SmartTarget job objects, use Get-DbaXESmartTarget.

$response = New-DbaXESmartReplay -SqlInstance sql2017 -Database planning
Start-DbaXESmartTarget -SqlInstance sql2016 -Session loadrelay -Responder $response

Replays events from the ‘Profiler Standard’ session on sql2016 to sql2017’s planning database. Does not run as a job so you can see the raw output.

$response = New-DbaXESmartReplay -SqlInstance sql2017 -Database planning
Start-DbaXESmartTarget -SqlInstance sql2017 -Session ‘Profiler Standard’ -Responder $response -NotAsJob


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


From PowerShell, execute Get-Help New-DbaXESmartReplay -Detailed for more information on this function.

Source Code

Want to see the source code? View New-DbaXESmartReplay.ps1 on GitHub

Related commands