Author | Chrissy LeMaire (@cl), netnerds.net |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Get-DbaDbTrigger on GitHub.
Want to see the Bill Of Health for this command? Check out Get-DbaDbTrigger.
Retrieves database-level DDL triggers from SQL Server instances for security auditing and change tracking analysis.
Retrieves all database-level DDL triggers from one or more SQL Server instances. Database triggers fire in response to DDL events like CREATE, ALTER, or DROP statements within a specific database, making them useful for change auditing and security monitoring. This function helps DBAs inventory these triggers for compliance reporting, troubleshooting performance issues, or documenting automated database change tracking mechanisms. Returns trigger details including name, enabled status, and last modification date.
Get-DbaDbTrigger
[[-SqlInstance] <DbaInstanceParameter[]>]
[[-SqlCredential] <PSCredential>]
[[-Database] <Object[]>]
[[-ExcludeDatabase] <Object[]>]
[[-InputObject] <Database[]>]
[-EnableException]
[<CommonParameters>]
PS C:\> Get-DbaDbTrigger -SqlInstance sql2017
Returns all database triggers
PS C:\> Get-DbaDatabase -SqlInstance sql2017 -Database supa | Get-DbaDbTrigger
Returns all triggers for database supa on sql2017
PS C:\> Get-DbaDbTrigger -SqlInstance sql2017 -Database supa
Returns all triggers for database supa on sql2017
The target SQL Server instance or instances.
Alias | |
Required | False |
Pipeline | false |
Default Value |
SqlLogin 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 |
Specifies which databases to scan for DDL triggers. Accepts wildcards for pattern matching.
Use this when you need to audit triggers in specific databases rather than checking all databases on the instance.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Excludes specific databases from the trigger scan. Useful for skipping system databases or databases under maintenance.
Commonly used to exclude tempdb, model, or databases that don't require trigger auditing.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Accepts database objects from Get-DbaDatabase via pipeline input for targeted trigger analysis.
Use this when you want to process a pre-filtered set of database objects instead of specifying database names.
Alias | |
Required | False |
Pipeline | true (ByValue) |
Default Value |
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 |