Sander Stad provides a script to export SQL Server objects using Powershell:
Scripting SQL Server objects manually through the SQL Server Management Studio can be a tedious task. Last week I published a script to export database objects with PowerShell. I wanted to take this a little further and create a solution to export SQL Server objects as well.
Because this would be a nice addition to the PSSQLLibmodule, this function is also included in the library from today.
I haven’t tried using this cmdlet yet, but it does look handy.