Scripting Tables with dbatools


 * https://voiceofthedba.com/2018/03/23/scripting-tables-with-dbatools/


 * dbatools: https://dbatools.io/


 * Tagged dbatools: https://voiceofthedba.com/tag/dbatools/

cmdlets

 * Get-DbaTable: https://dbatools.io/Get-DbaTable
 * Export-DbaScript: https://dbatools.io/Export-DbaScript


 * sample command: Get-DbaTable -SqlInstance ?server-name?\?instance-name? -Database ?database-name? | Export-DbaScript


 * Get-DbaTable ?server-name?\?instance-name? -Database ?database-name? | ForEach-Object { Export-DbaScript -InputObject $_ -Path ($_.Name + “.sql”) }