ConvertTo‑SqlDscDataFile - dsccommunity/SqlServerDsc GitHub Wiki
Converts a DatabaseFileSpec object to a SMO DataFile object.
ConvertTo-SqlDscDataFile [-FileGroupObject] <FileGroup> [-DataFileSpec] <DatabaseFileSpec>
[<CommonParameters>]
This command takes a DatabaseFileSpec specification object and converts it to a SMO (SQL Server Management Objects) DataFile object. This is used internally when creating databases with custom file configurations.
$fileSpec = New-SqlDscDataFile -Name 'TestDB_Data' -FileName 'C:\SQLData\TestDB.mdf' -AsSpec
$fileGroup = [Microsoft.SqlServer.Management.Smo.FileGroup]::new($database, 'PRIMARY')
$dataFile = ConvertTo-SqlDscDataFile -FileGroupObject $fileGroup -DataFileSpec $fileSpec
Converts a DatabaseFileSpec to a SMO DataFile object.
The DatabaseFileSpec object containing the data file configuration.
Type: DatabaseFileSpec
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe SMO FileGroup object to which the DataFile will belong.
Type: FileGroup
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
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.