Constantine Kokkinos shows how easy it is to use dbatools to script out database objects:
@brianszadek says: I am looking to automate the scripting of objects with PowerShell for easier source control integration.
I thought this would be a little bit easier, but it looks like the SMO way of doing this is still fairly complicated. Maybe something I can look at simplifying for the project in a bit
If you want to get your database into source control but feel like it’s going to be a time-consuming challenge, this isn’t the time-consuming part.