commands

^

New-DbaScriptingOption

Author Chrissy LeMaire (@cl), netnerds.net
Availability Windows, Linux, macOS

 

Want to see the source code for this command? Check out New-DbaScriptingOption on GitHub.
Want to see the Bill Of Health for this command? Check out New-DbaScriptingOption.

Synopsis

Creates a new Microsoft.SqlServer.Management.Smo.ScriptingOptions object

Description

Creates a new Microsoft.SqlServer.Management.Smo.ScriptingOptions object. Basically saves you the time from remembering the SMO assembly name ;)

See https://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.scriptingoptions.aspx for more information

Syntax

New-DbaScriptingOption
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> $options = New-DbaScriptingOption
PS C:\> $options.ScriptDrops = $false
PS C:\> $options.WithDependencies = $false
PS C:\> $options.AgentAlertJob = $true
PS C:\> $options.AgentNotify = $true
PS C:\> Get-DbaAgentJob -SqlInstance sql2016 | Export-DbaScript -ScriptingOptionObject $options

Exports Agent Jobs with the Scripting Options ScriptDrops/WithDependencies set to $false and AgentAlertJob/AgentNotify set to true