commands

^

Export-DbaSysDbUserObject

Author Jess Pomfret (@jpomfret)
Availability Windows, Linux, macOS

 

Synopsis

Exports all user objects found in source SQL Server's master, msdb and model databases to the FilePath.

Description

Exports all user objects found in source SQL Server's master, msdb and model databases to the FilePath.

Syntax

Export-DbaSysDbUserObject
    [-SqlInstance] <DbaInstanceParameter>
    [[-SqlCredential] <PSCredential>]
    [-IncludeDependencies]
    [[-BatchSeparator] <String>]
    [[-Path] <String>]
    [[-FilePath] <String>]
    [-NoPrefix]
    [[-ScriptingOptionsObject] <ScriptingOptions>]
    [-NoClobber]
    [-PassThru]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Export-DbaSysDbUserObject -SqlInstance server1

Exports any user objects that are in the system database to the default location.

Required Parameters

-SqlInstance

The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.

Alias
Required True
Pipeline true (ByValue)
Default Value

Optional Parameters

-SqlCredential

Login to the target instance using alternative credentials. Windows and SQL Authentication supported. Accepts credential objects (Get-Credential)

Alias
Required False
Pipeline false
Default Value
-IncludeDependencies

Specifies whether dependent objects are also scripted out.

Alias
Required False
Pipeline false
Default Value False
-BatchSeparator

Batch separator for scripting output. "GO" by default.

Alias
Required False
Pipeline false
Default Value GO
-Path

Specifies the directory where the file or files will be exported.

Alias
Required False
Pipeline false
Default Value (Get-DbatoolsConfigValue -FullName 'Path.DbatoolsExport')
-FilePath

Specifies the full file path of the output file.

Alias
Required False
Pipeline false
Default Value
-NoPrefix

If this switch is used, the scripts will not include prefix information containing creator and datetime.

Alias
Required False
Pipeline false
Default Value False
-ScriptingOptionsObject

Add scripting options to scripting output.

Alias
Required False
Pipeline false
Default Value
-NoClobber

Do not overwrite file.

Alias
Required False
Pipeline false
Default Value False
-PassThru

Output script to console.

Alias
Required False
Pipeline false
Default Value False
-EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message. This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting. Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

Alias
Required False
Pipeline false
Default Value False

 

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