# spaceused.ps1
# Lists space used by tables in database of your choice

write-host
write-host ('Space Listing For Tables in Database: ' + $args[0])

$s = new-object ($smo + 'server') .
$db = $s.databases[$args[0]]
$db.tables | format-table Name, DataSpaceUsed, IndexSpaceUsed -autosize