commands

^

Get-DbaStartupProcedure

Author Patrick Flynn (@sqllensman)
Availability Windows, Linux, macOS

 

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

Synopsis

Get-DbaStartupProcedure gets startup procedures (user defined procedures within master database) from a SQL Server.

Description

By default, this command returns for each SQL Server instance passed in, the SMO StoredProcedure object for all procedures in the master database that are marked as a startup procedure.
Can be filtered to check only specific procedures

Syntax

Get-DbaStartupProcedure
    [-SqlInstance] <DbaInstanceParameter[]>
    [[-SqlCredential] <PSCredential>]
    [[-StartupProcedure] <String[]>]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Get-DbaStartupProcedure -SqlInstance SqlBox1\Instance2

Returns an object with all startup procedures for the Instance2 instance on SqlBox1

Example: 2
PS C:\> Get-DbaStartupProcedure -SqlInstance SqlBox1\Instance2 -StartupProcedure 'dbo.StartupProc'

Returns an object with a startup procedure named 'dbo.StartupProc' for the Instance2 instance on SqlBox1

Example: 3
PS C:\> Get-DbaRegServer -SqlInstance sql2014 | Get-DbaStartupProcedure

Returns an object with all startup procedures for every server listed in the Central Management Server on sql2014

Required Parameters

-SqlInstance

The target SQL Server instance or instances.

Alias
Required True
Pipeline true (ByValue)
Default Value

Optional Parameters

-SqlCredential

Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.

Alias
Required False
Pipeline false
Default Value
-StartupProcedure

Use this filter to check if specific procedure(s) are set as startup procedures.

Alias
Required False
Pipeline false
Default Value
-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