Skip to content

Commit

Permalink
CLREnabled added and tested #882
Browse files Browse the repository at this point in the history
  • Loading branch information
SQLDBAWithABeard committed May 5, 2022
1 parent 91102f5 commit a81ea5f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Validate v4 adn v5.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ RUN THIS SECTION MANUALLY IF YOU JUST IMPORT THE FUNCTION BELOW!
ipmo ./dbachecks.psd1
$Checks = 'TraceFlagsNotExpected','TraceFlagsExpected','TwoDigitYearCutoff','MaxDopInstance','ErrorLogCount','ModelDbGrowth','DefaultBackupCompression','SaExist','SaDisabled','SaRenamed','DefaultFilePath','AdHocDistributedQueriesEnabled','AdHocWorkload', 'DefaultTrace', 'OleAutomationProceduresDisabled', 'CrossDBOwnershipChaining', 'ScanForStartupProceduresDisabled', 'RemoteAccessDisabled', 'SQLMailXPsDisabled', 'DAC', 'OLEAutomation'
$Checks = 'TraceFlagsNotExpected'
$Checks = 'CLREnabled','TraceFlagsNotExpected','TraceFlagsExpected','TwoDigitYearCutoff','MaxDopInstance','ErrorLogCount','ModelDbGrowth','DefaultBackupCompression','SaExist','SaDisabled','SaRenamed','DefaultFilePath','AdHocDistributedQueriesEnabled','AdHocWorkload', 'DefaultTrace', 'OleAutomationProceduresDisabled', 'CrossDBOwnershipChaining', 'ScanForStartupProceduresDisabled', 'RemoteAccessDisabled', 'SQLMailXPsDisabled', 'DAC', 'OLEAutomation'
$Checks = 'CLREnabled'
Compare-v4andv5Results -Checks $Checks
# if you need to see the details to see why the results are different
Expand Down Expand Up @@ -129,6 +129,7 @@ and
For v5 we ran
{1} tests
The MOST COMMON REASON IS you have used Tags instead of Tag in your Describe block
but TraceFlagsNotExpected will change that also
" -f $v4code.TotalCount, ($v5code.TotalCount - $v5code.NotRunCount)
Write-PSFMessage -Message $Message -Level Warning
}
Expand Down
9 changes: 9 additions & 0 deletions checks/Instancev5.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,12 @@ Describe "Trace Flags Not Expected" -Tag TraceFlagsNotExpected, TraceFlag, Mediu
}
}
}

Describe "CLR Enabled" -Tag CLREnabled, security, CIS, High, Instance -ForEach $InstancesToTest {
$skip = Get-DbcConfigValue skip.instance.CLREnabled
Context "Testing CLR Enabled on <_.Name>" {
It "CLR Enabled is set to <_.ConfigValues.CLREnabled> on <_.Name>" -Skip:$skip {
$PSItem.Configuration.IsSqlClrEnabled.ConfigValue -eq 1 | Should -Be $psitem.ConfigValues.CLREnabled -Because 'This is the setting you have chosen for CLR Enabled'
}
}
}
4 changes: 4 additions & 0 deletions internal/functions/NewGet-AllInstanceInfo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ function NewGet-AllInstanceInfo {
ActualTraceFlags = $TraceFlagsActual
}
}
'CLREnabled' {
$configurations = $true
$ConfigValues | Add-Member -MemberType NoteProperty -Name 'CLREnabled' -Value (Get-DbcConfigValue policy.security.clrenabled)
}
Default { }
}

Expand Down

0 comments on commit a81ea5f

Please sign in to comment.