Add-SqlLogFile

Adds a new LogFile to a database.

Syntax

Add-SqlLogFile [-database] <Database> [-name] <String> [-filepath] <String> [[-size] <Double>] [[-growthType] {KB | Percent | None}] [[-growth] <Double>] [[-maxSize] <Double>] [<CommonParameters>]

Detailed Description

The Add-SqlLogFile function adds a new LogFile to the specified database.

Related Commands

* Add-SqlLogFile
* Add-SqlDatabase
* Get-SqlDatabase

Parameters

Name Description Required? Pipeline Input Default Value
database    true  false   
name    true  false   
filepath    true  false   
size    false  false   
growthType    false  false   
growth    false  false   
maxSize    false  false   

Input Type

None You cannot pipe objects to Add-SqlLogFile

Return Values

Microsoft.SqlServer.Management.Smo.LogFile Add-SqlLogFile returns an Microsoft.SqlServer.Management.Smo.LogFile object.

Notes

Add-SqlLogFile is used by Add-SqlDatabase.

Examples

EXAMPLE 1

$database = Get-SqlDatabase "Z002\sql2k8" "pubs"
Add-SqlLogFile -database $database -name 'pubs_LogFile1' -filepath 'C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2K8\MSSQL\DATA\pubs_LogFile1.ldf'
$database.Alter()
This command adds the LogFile LogFile2 to the pubs database.