Test‑SqlDscConfigurationOption - dsccommunity/SqlServerDsc GitHub Wiki
Test if server configuration option has the specified value.
Test-SqlDscConfigurationOption [-ServerObject] <Server> [-Name] <String> [-Value] <Int32>
[<CommonParameters>]
This command tests whether a SQL Server Database Engine configuration option has the specified value using SQL Server Management Objects (SMO). The function validates that the option exists and compares the current value with the expected value.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$serverObject | Test-SqlDscConfigurationOption -Name "Agent XPs" -Value 1
Tests if the "Agent XPs" configuration option is enabled (1).
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
Test-SqlDscConfigurationOption -ServerObject $serverObject -Name "cost threshold for parallelism" -Value 50
Tests if the "cost threshold for parallelism" configuration option is set to 50.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$serverObject | Test-SqlDscConfigurationOption -Name "max degree of parallelism" -Value 4
Tests if the "max degree of parallelism" option is set to 4.
Specifies the name of the configuration option to test.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies current server connection object.
Type: Server
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Specifies the expected value for the configuration option.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
This function does not support ShouldProcess as it is a read-only operation.