Invoke-CheckContainmentStatus
SYNOPSIS
Check the containment status of a SQL Server database.
SYNTAX
DESCRIPTION
This function checks whether a specified SQL Server database is contained or not by querying the `sys.databases` system view. It returns `$true` if the database is contained and `$false` otherwise. If an error occurs during the query, an error message is displayed, and the function exits.
EXAMPLES
EXAMPLE 1
Checks if the "TestDB" database is contained and returns `$true` or `$false`.
EXAMPLE 2
Checks if the "ProductionDB" database is contained and returns `$true` or `$false`.
PARAMETERS
-SQLServer
The name of the SQL Server where the database is hosted.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-SQLDBName
The name of the SQL Server database to check for containment status.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
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.