Author | Brandon Abshire, netnerds.net |
Availability | Windows, Linux, macOS |
Aliases : Get-DbaDbModule
Want to see the source code for this command? Check out Get-DbaModule on GitHub.
Want to see the Bill Of Health for this command? Check out Get-DbaModule.
Displays all objects in sys.sys_modules after specified modification date. Works on SQL Server 2008 and above.
Quickly find modules (Stored Procs, Functions, Views, Constraints, Rules, Triggers, etc) that have been modified in a database, or across all databases.
Results will exclude the module definition, but can be queried explicitly.
Get-DbaModule
[[-SqlInstance] <DbaInstanceParameter[]>]
[[-SqlCredential] <PSCredential>]
[[-Database] <Object[]>]
[[-ExcludeDatabase] <Object[]>]
[[-ModifiedSince] <DateTime>]
[[-Type] <String[]>]
[-ExcludeSystemDatabases]
[-ExcludeSystemObjects]
[[-InputObject] <Database[]>]
[-EnableException]
[<CommonParameters>]
PS C:\> Get-DbaModule -SqlInstance sql2008, sqlserver2012
Return all modules for servers sql2008 and sqlserver2012 sorted by Database, Modify_Date ASC.
PS C:\> Get-DbaModule -SqlInstance sql2008, sqlserver2012 | Select-Object *
Shows hidden definition column (informative wall of text).
PS C:\> Get-DbaModule -SqlInstance sql2008 -Database TestDB -ModifiedSince "2017-01-01 10:00:00"
Return all modules on server sql2008 for only the TestDB database with a modified date after 1 January 2017 10:00:00 AM.
PS C:\> Get-DbaModule -SqlInstance sql2008 -Type View, Trigger, ScalarFunction
Return all modules on server sql2008 for all databases that are triggers, views or scalar functions.
PS C:\> 'sql2008' | Get-DbaModule -Database TestDB -Type View, StoredProcedure, ScalarFunction
Return all modules on server sql2008 for only the TestDB database that are stored procedures, views or scalar functions. Input via Pipeline
PS C:\> Get-DbaDatabase -SqlInstance sql2008 -ExcludeSystem | Get-DbaModule -Type View, Trigger, ScalarFunction
Return all modules on server sql2008 for all user databases that are triggers, views or scalar functions.
PS C:\> Get-DbaDatabase -SqlInstance sql2008, sqlserver2012 -ExcludeUser | Get-DbaModule -Type StoredProcedure -ExcludeSystemObjects
Return all user created stored procedures in the system databases for servers sql2008 and sqlserver2012.
The target SQL Server instance or instances.
Alias | |
Required | False |
Pipeline | true (ByValue) |
Default Value |
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 |
The database(s) to process. If unspecified, all databases will be processed.
Alias | |
Required | False |
Pipeline | false |
Default Value |
The database(s) to exclude.
Alias | |
Required | False |
Pipeline | false |
Default Value |
DateTime value to use as minimum modified date of module.
Alias | |
Required | False |
Pipeline | false |
Default Value | 1900-01-01 |
Limit by specific type of module. Valid choices include: View, TableValuedFunction, DefaultConstraint, StoredProcedure, Rule, InlineTableValuedFunction, Trigger, ScalarFunction
Alias | |
Required | False |
Pipeline | false |
Default Value | |
Accepted Values | View,TableValuedFunction,DefaultConstraint,StoredProcedure,Rule,InlineTableValuedFunction,Trigger,ScalarFunction |
Allows you to suppress output on system databases
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Allows you to suppress output on system objects
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Enables piping from Get-DbaDatabase.
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 |