How to Get the Table Statistics with PowerShell?

# Step 1 - Do we have a get_statistics method? Yes, we do!
PS SQLSERVER:\sql\xu-acer-pc\default\databases\adventureworks2014\tables> gci | gm -force

# Step 2 - Using the method get all of the statistic for all tables in a database and output them to a file, pick up the attributes or column names you need


PS SQLSERVER:\sql\xu-acer-pc\default\databases\adventureworks2014\tables> dir | %{$a=$_.get_Statistics(); $a | format-table @{Label="Table"; Expression={$_.Parent}}, name, LastUpdated, IsAutoCreated -auto |Out-File c:\TableStats.txt -append; "$a is finished!!!"}