dbatools is a free PowerShell module with over 300 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


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.




Return all modules for servers sql2008 and sqlserver2012 sorted by Database, Modify_Date ASC.

Get-DbaSqlModule -SqlServer sql2008, sqlserver2012

Shows hidden definition column (informative wall of text).

Get-DbaSqlModule -SqlServer sql2008, sqlserver2012 | Select *

Return all modules on server sql2008 for only the TestDB database with a modified date after 01/01/2017 10:00:00 AM

Get-DbaSqlModule -SqlServer sql2008 -Database TestDB -ModifiedSince “01/01/2017 10:00:00 AM”

Return all modules on server sql2008 for all databases that are triggers, views or scalar functions.

Get-DbaSqlModule -SqlServer sql2008 -Type View, Trigger, ScalarFunction


This command was created by Brandon Abshire. You can find Brandon blogging at netnerds.net.


From PowerShell, execute Get-Help Get-DbaSqlModule -Detailed for more information on this function.

Source Code

Want to see the source code? View Get-DbaSqlModule.ps1 on GitHub

Related commands