ConvertTo‑SqlDscFileGroup - dsccommunity/SqlServerDsc GitHub Wiki
Converts a DatabaseFileGroupSpec object to a SMO FileGroup object.
ConvertTo-SqlDscFileGroup [-DatabaseObject] <Database> [-FileGroupSpec] <DatabaseFileGroupSpec>
[<CommonParameters>]
This command takes a DatabaseFileGroupSpec specification object and converts it to a SMO (SQL Server Management Objects) FileGroup object with all configured data files. This is used internally when creating databases with custom file group configurations.
$fileSpec = New-SqlDscDataFile -Name 'TestDB_Data' -FileName 'C:\SQLData\TestDB.mdf' -AsSpec
$fileGroupSpec = New-SqlDscFileGroup -Name 'PRIMARY' -Files @($fileSpec) -AsSpec
$smoFileGroup = ConvertTo-SqlDscFileGroup -DatabaseObject $database -FileGroupSpec $fileGroupSpec
Converts a DatabaseFileGroupSpec to a SMO FileGroup object with data files.
The SMO Database object to which the FileGroup will belong.
Type: Database
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe DatabaseFileGroupSpec object containing the file group configuration.
Type: DatabaseFileGroupSpec
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.