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


Clear-DbaWaitStatistics

Reset the aggregated statistics – basically just executes DBCC SQLPERF (N’sys.dm_os_wait_stats’, CLEAR).

Screenshots

dbatools-Clear-DbaWaitStatistics

Examples

After confirmation, clears wait stats on servers sql2008 and sqlserver2012.

Clear-DbaWaitStatistics -SqlInstance sql2008, sqlserver2012

Clears wait stats on servers sql2008 and sqlserver2012, without prompting.

Clear-DbaWaitStatistics -SqlInstance sql2008, sqlserver2012 -Confirm:$false

Author

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

Get-Help

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

Source Code

Want to see the source code? View Clear-DbaWaitStatistics.ps1 on GitHub
 

Related commands