dbatools is a free PowerShell module with over 200 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


This function recursively finds all objects that depend on the input. It will then retrieve rich information from them, including their creation scripts and the order in which it should be applied.

By using the ‘Parents’ switch, the function will instead retrieve all items that the input depends on (including their creation scripts).

For more details on dependency, see: [technet.microsoft.com](https://technet.microsoft.com/en-us/library/ms345449(v=sql.105)



To return objects that depend on the “Customers” table

(Get-DbaDatabase -SqlInstance sql2012 Northwind).tables | Where Name -eq Customers | Get-DbaDependency


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

Source Code

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

Related commands