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


Shows table information around table row and data sizes and if it has any table type information.



To return all tables in the Test1 database.

Get-DbaTable -SqlInstance DEV01 -Database Test1

To return only information on the table MyTable from the database MyDB.

Get-DbaTable -SqlInstance DEV01 -Database MyDB -Table MyTable

To return information on table called MyTable if it exists in any database on the server, under any schema

Get-DbaTable -SqlInstance DEV01 -Table MyTable

To return information on the CommandLog table in the DBA database on both instances localhost and the named instance localhost\namedinstance.

‘localhost’,’localhost\namedinstance’ | Get-DbaTable -Database DBA -Table Commandlog


This command was created by Stephen Bennett. You can find Stephen blogging at sqlnotesfromtheunderground.wordpress.com.


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

Source Code

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

Related commands