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


Enable-DbaTraceFlag

The function will set one or multiple trace flags on the SQL Server instance(s) listed.

Screenshots

dbatools-Enable-DbaTraceFlag

Examples

Enable the trace flag 32266 on SQL Server instance sql2016.

Enable-DbaTraceFlag -SqlInstance sql2016 -TraceFlag 3226

Enable multiple trace flags on SQL Server instance sql2016.

Enable-DbaTraceFlag -SqlInstance sql2016 -TraceFlag 1117, 1118

Author

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

Get-Help

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

Source Code

Want to see the source code? View Enable-DbaTraceFlag.ps1 on GitHub
 

Related commands