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


Find-DbaDisabledIndex

This command will help you to find disabled indexes on a database or a list of databases.

Screenshots

dbatools-Find-DbaDisabledIndex

Examples

Generates the SQL statements to drop the selected disabled indexes on server “sql2005”.

Find-DbadisabledIndex -SqlInstance sql2005

Generates the SQL statements to drop the selected disabled indexes on server “sqlserver2016”, using SQL Authentication to connect to the database.

Find-DbadisabledIndex -SqlInstance sqlserver2016 -SqlCredential $cred

Generates the SQL Statement to drop selected indexes in databases db1 & db2 on server “sqlserver2016”.

Find-DbadisabledIndex -SqlInstance sqlserver2016 -Database db1, db2

Generates the SQL statements to drop selected indexes on all user databases.

Find-DbadisabledIndex -SqlInstance sqlserver2016

Author

This command was created by Jason Squires. You can find Jason on Twitter.

Get-Help

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

Source Code

Want to see the source code? View Find-DbaDisabledIndex.ps1 on GitHub
 

Related commands