dbatools is a free PowerShell module with over 200 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


Invoke-DbaCycleErrorLog

Cycles the current error log for the instance (SQL Server) and/or SQL Server Agent.

Screenshots

dbatools - Invoke-DbaCycleErrorLog

Examples

Cycles the current error log for the SQL Server Agent on SQL Server instance sql2016.

Invoke-DbaCycleLog -SqlInstance sql2016 -Type agent

Cycles the current error log for the SQL Server instance on SQL Server instance sql2016.

Invoke-DbaCycleLog -SqlInstance sql2016 -Type instance

Cycles the current error log for both SQL Server instance and SQL Server Agent on SQL Server instance sql2016.

Invoke-DbaCycleLog -SqlInstance sql2016

Author

This command was created by Shawn Melton. You can find Shawn on Twitter and his blog.

Get-Help

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

Source Code

Want to see the source code? View Invoke-DbaCycleErrorLog.ps1 on GitHub
 

Related commands