Add‑SqlDscFileGroup - dsccommunity/SqlServerDsc GitHub Wiki

SYNOPSIS

Adds one or more FileGroup objects to a Database object.

SYNTAX

Add-SqlDscFileGroup [-Database] <Database> [-FileGroup] <FileGroup[]> [-PassThru] [-Force]
 [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

This command adds one or more FileGroup objects to a Database object's FileGroups collection. This is useful when you have created FileGroup objects using New-SqlDscFileGroup and want to associate them with a Database.

EXAMPLES

EXAMPLE 1

Add-SqlDscFileGroup -Database $database -FileGroup $fileGroup

Adds a single FileGroup to the Database.

EXAMPLE 2

$fileGroups | Add-SqlDscFileGroup -Database $database -PassThru

Adds multiple FileGroups to the Database via pipeline and returns the FileGroup objects.

PARAMETERS

-Database

Specifies the Database object to which the FileGroups will be added.

Type: Database
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-FileGroup

Specifies one or more FileGroup objects to add to the Database. This parameter accepts pipeline input.

Type: FileGroup[]
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-Force

Specifies that the FileGroup should be added without confirmation.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-PassThru

Returns the FileGroup objects that were added to the Database.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
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.

INPUTS

Microsoft.SqlServer.Management.Smo.FileGroup

FileGroup objects that will be added to the Database.

OUTPUTS

None

This cmdlet does not generate output by default.

Microsoft.SqlServer.Management.Smo.FileGroup[]

When the PassThru parameter is specified, returns the FileGroup objects that were added.

NOTES

RELATED LINKS

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