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


Stops and closes the specified trace and deletes its definition from the server.




Stops all traces on sql2008.

Remove-DbaTrace -SqlInstance sql2008

Stops the trace with ID 1 on sql2008.

Remove-DbaTrace -SqlInstance sql2008 -Id 1

Stops selected traces on sql2008.

Get-DbaTrace -SqlInstance sql2008 | Out-GridView -PassThru | Remove-DbaTrace


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


From PowerShell, execute Get-Help Remove-DbaTrace -Detailed for more information on this function.

Source Code

Want to see the source code? View Remove-DbaTrace.ps1 on GitHub

Related commands