Test‑SqlDscConfigurationOption - dsccommunity/SqlServerDsc GitHub Wiki

SYNOPSIS

Test if server configuration option has the specified value.

SYNTAX

Test-SqlDscConfigurationOption [-ServerObject] <Server> [-Name] <String> [-Value] <Int32>
 [<CommonParameters>]

DESCRIPTION

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.

EXAMPLES

EXAMPLE 1

$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$serverObject | Test-SqlDscConfigurationOption -Name "Agent XPs" -Value 1

Tests if the "Agent XPs" configuration option is enabled (1).

EXAMPLE 2

$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.

EXAMPLE 3

$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.

PARAMETERS

-Name

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

-ServerObject

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

-Value

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

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

Microsoft.SqlServer.Management.Smo.Server

SQL Server Management Objects (SMO) Server object representing a SQL Server instance.

OUTPUTS

System.Boolean

Returns $true if the configuration option has the specified value, $false otherwise.

NOTES

This function does not support ShouldProcess as it is a read-only operation.

RELATED LINKS

⚠️ **GitHub.com Fallback** ⚠️