Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

How to consolidate multiple Format-Tables into One table

$
0
0

Hi,

Here's my code which does run successfully...

[System.Reflection.Assembly]::LoadWithPartialName "Microsoft.SqlServer.Smo") | Out-Null

$SQLConn

 

 

=New-Object ('Microsoft.SqlServer.Management.Smo.Server') "mysqlserver"

foreach

 

 

 

($Databasein$SQLConn.Databases) {$Database.Tables | Where-OBject{$_.IsSystemObject -eq 0} | select-object @{name="Database Name";expression={$Database.Name}}, Name, RowCount, DataSpaceUsed, IndexSpaceUsed, Schema, Owner | Format-Table-AutoSize -Wrap}

...however, it returns a separate list of database tables for each database (as you may expect). Instead, I want it to output just one list of all databases' tables with one header row.

how do i do that?

 

many thanks


Viewing all articles
Browse latest Browse all 6937

Trending Articles