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


Get-DbaMaintenanceSolutionLog

Ola wrote a .sql script to get the content from the commandLog table. However, if LogToTable=’N’, there will be no logging in that table. This function reads the text files that are written in the SQL Instance’s Log directory.

Screenshots

dbatools-Get-DbaMaintenanceSolutionLog

Examples

Gets the outcome of the IndexOptimize job on sql instance sqlserver2014a.

Get-DbaMaintenanceSolutionLog -SqlInstance sqlserver2014a

Gets the outcome of the IndexOptimize job on sqlserver2014a, using SQL Authentication.

Get-DbaMaintenanceSolutionLog -SqlInstance sqlserver2014a -SqlCredential $credential

Gets the outcome of the IndexOptimize job on sqlserver2014a and sqlserver2020test.

‘sqlserver2014a’, ‘sqlserver2020test’ | Get-DbaMaintenanceSolutionLog

Gets the outcome of the IndexOptimize job on sqlserver2014a, reading the log files in their custom location.

Get-DbaMaintenanceSolutionLog -SqlInstance sqlserver2014a -Path ‘D:\logs\maintenancesolution\’

Gets the outcome of the IndexOptimize job on sqlserver2014a, starting from July 18, 2017.

Get-DbaMaintenanceSolutionLog -SqlInstance sqlserver2014a -Since ‘2017-07-18’

Gets the outcome of the IndexOptimize job on sqlserver2014a, the other options are not yet available! sorry

Get-DbaMaintenanceSolutionLog -SqlInstance sqlserver2014a -LogType IndexOptimize

Author

This command was created by Klaas Vandenberghe. You can find Klaas on Twitter.

This command was created by Simone Bizzotto. You can find Simone on Twitter.

Get-Help

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

Source Code

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

Related commands