
Have you embraced the awesomeness that is dbachecks? dbachecks is a great framework that was built to check your SQL Environment for best practices and alert you to out of compliance items that can be acted upon.
I have recently been building a demo to introduce the tool to my work team. While doing this I have learned a lot of great stuff and been deep diving in to the configuration side of dbachecks. Today Mr. Rob Sewell (b | t) pointed out a global configuration value that I guess I had missed when it was added or I overlooked it from the beginning.
Issue
While tweaking my
Invoke-DbcCheck the list of
-ExcludeCheck checks keeps growing and growing.
1 |
Invoke-DbcCheck -SqlInstance $Servers -ComputerName $Servers -Check $_ -ExcludeDatabase ReportServer, ReportServerTempDB -ExcludeCheck TestLastBackup, TestLastBackupVerifyOnly, LinkedServerConnection, SPN, MaintenanceSolution, SaRenamed, LastGoodCheckDb, LogShipping, InvalidDatabaseOwner -PassThru | Update-DbcPowerBiDataSource -Environment Production |
Sure does make for a long command line to scroll thru.
Solution
It seems as though there is a config for this. command.invokedbccheck.excludecheck
Turn your back for one second and those hard working dbachecks contributors will sneak something by you. But in this case it is a good addition, even though I am not sure when it was added as I cannot figure out Git sometimes.
What that means is that instead of filling up your command line with
-ExcludeCheck values you can run code like this to set it once and forget it.
1 |
Set-DbcConfig -Name command.invokedbccheck.excludecheck -Value @('TestLastBackup', 'TestLastBackupVerifyOnly', 'LinkedServerConnection', 'SPN', 'MaintenanceSolution', 'SaRenamed', 'LastGoodCheckDb', 'LogShipping', 'InvalidDatabaseOwner') |
This also allows you to use the
Export-DbcConfig and
Import-DbcConfig to save these settings.
Conclusion
Start using dbachecks and keep an eye on the repo for the quickly and ever changing code to get new features often.