Generate T-SQL Script for a List of Views
USE:
CLEAR
$sSRCServer = "TUIRA"
$sSRCDatabase = "AdventureWorks"
$oSO = New-SqlScriptingOptions
$oSO.Permissions = $true
$oSO.IncludeIfNotExists = $true
$a = Get-Content "C:tempviewlist.txt"
foreach ($o in $a) {
Get-SqlDatabase $sSRCServer $sSRCDatabase|Get-SqlView -Name $o| `
Get-SqlScripter -scriptingOptions $oSO
WRITE("GO `n`n`n")
}