Skip to content

Commit

Permalink
AdHocDistributedQueriesEnabled v5 check and tests for perfs and valid…
Browse files Browse the repository at this point in the history
…ation #882
  • Loading branch information
SQLDBAWithABeard committed Apr 26, 2022
1 parent 945227a commit f5ad707
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Perf Testing pesterv5.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ ipmo ./dbachecks.psd1

#

$Checks = 'AdHocWorkload','DefaultTrace', 'OleAutomationProceduresDisabled', 'CrossDBOwnershipChaining', 'ScanForStartupProceduresDisabled', 'RemoteAccessDisabled', 'SQLMailXPsDisabled', 'DAC', 'OLEAutomation'
$Checks = 'AdHocDistributedQueriesEnabled','AdHocWorkload', 'DefaultTrace', 'OleAutomationProceduresDisabled', 'CrossDBOwnershipChaining', 'ScanForStartupProceduresDisabled', 'RemoteAccessDisabled', 'SQLMailXPsDisabled', 'DAC', 'OLEAutomation'
$Checks = 'AdHocDistributedQueriesEnabled'
Compare-CheckRuns -Checks $checks

# Load the function below and then you can keep running the checks defined above in v4 and v5 and compare the performance
Expand Down
6 changes: 3 additions & 3 deletions Validate v4 adn v5.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ipmo ./dbachecks.psd1

#

$Checks = 'AdHocWorkload', 'DefaultTrace', 'OleAutomationProceduresDisabled', 'CrossDBOwnershipChaining', 'ScanForStartupProceduresDisabled', 'RemoteAccessDisabled', 'SQLMailXPsDisabled', 'DAC', 'OLEAutomation'
$Checks = 'AdHocDistributedQueriesEnabled','AdHocWorkload', 'DefaultTrace', 'OleAutomationProceduresDisabled', 'CrossDBOwnershipChaining', 'ScanForStartupProceduresDisabled', 'RemoteAccessDisabled', 'SQLMailXPsDisabled', 'DAC', 'OLEAutomation'
$Checks = 'AdHocDistributedQueriesEnabled'
Compare-v4andv5Results -Checks $Checks

Expand Down Expand Up @@ -134,6 +134,6 @@ For v5 we ran
$password = ConvertTo-SecureString "dbatools.IO" -AsPlainText -Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "sqladmin", $password
$Sqlinstances = 'localhost,7401', 'localhost,7402', 'localhost,7403'
Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check $Checks -legacy $false
Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check $Checks -legacy $true -Show Fails
Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check $Checks -legacy $false -PassThru -show None
Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check $Checks -legacy $true
#>
9 changes: 9 additions & 0 deletions checks/Instancev5.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,12 @@ Describe "Ad Hoc Workload Optimization" -Tag AdHocWorkload, Medium, Instance -Fo
}
}
}

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

Default { }
}
Expand Down

0 comments on commit f5ad707

Please sign in to comment.