In my previous post I illustrated scripting tables out with SMO in .NET. I have tested a new version this time in Powershell. I used the model with args, but you can just put it in the script as well. This also goes and scripts out your Views as well, but only the ones that are non-system objects, because if you take off the WHERE in the bottom, you will get all the sys.* and INFORMATION_SCHEMA views as well.
# scripttables.ps1
# Lists space used by tables in database of your choice
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | out-null
$server = $args[0]
$dbname = $args[1]
$output = "c:\temp\output.txt"
$srv = New-Object "Microsoft.SqlServer.Management.SMO.Server" $server
$db = New-Object ("Microsoft.SqlServer.Management.SMO.Database")
$scr = New-Object ("Microsoft.SqlServer.Management.Smo.Scripter")
$db = $srv.Databases[$dbname]
$scr.Server = $srv
$options = New-Object ("Microsoft.SqlServer.Management.SMO.ScriptingOptions")
$options.DriAll = $True
$options.ClusteredIndexes = $true
$options.Default = $true
$options.DriAll = $true
$options.Indexes = $true
$options.IncludeHeaders = $true
$options.AppendToFile = $false
$options.FileName = $output
$options.ToFileOnly = $true
$scr.Options = $options
$scr.Script($db.Tables)
$options.AppendToFile = $true
$views = $db.Views | where {$_.IsSystemObject -eq $false}
$scr.Script($views)