Take a look at my SQL Server SMO article “Using SQL Server Management Objects with PowerShell” in the “SQL Server Pro” April magazine is available now on the internet: http://www.sqlmag.com/article/windows-powershell/sql-server-managment-objects-powershell-144832
