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 function returns a list of Traces on a SQL Server Instance and identify the default Trace File.




Lists all the tracefiles on the sql2016 SQL Server.

Get-DbaTrace -SqlInstance sql2016

Lists the default trace information on the sql2016 SQL Server.

Get-DbaTrace -SqlInstance sql2016 -Default


This command was created by Garry Bargsley. You can find Garry on Twitter and his blog.


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

Source Code

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

Related commands