Add-SqlFileGroup

Adds a new filegroup to a database.

Syntax

Add-SqlFileGroup [-database] <Database> [-name] <String> [<CommonParameters>]

Detailed Description

The Add-SqlFileGroup function Adds a new filegroup to the specified database.

Related Commands

* Add-SqlFileGroup
* Add-SqlDatabase
* Get-SqlDatabase

Parameters

Name Description Required? Pipeline Input Default Value
database    true  false   
name    true  false   

Input Type

None You cannot pipe objects to Add-SqlFileGroup

Return Values

Microsoft.SqlServer.Management.Smo.FileGroup Add-SqlFileGroup returns an Microsoft.SqlServer.Management.Smo.FileGroup object.

Notes

Add-SqlFileGroup is used by Add-SqlDatabase.

Examples

EXAMPLE 1

$database = Get-SqlDatabase "Z002\sql2k8" "pubs"
Add-SqlFileGroup $database 'FileGroup2'
$database.Alter()
This command adds the filegroup FileGroup2 to the pubs database.