Skip to content

Instantly share code, notes, and snippets.

View jgilfillan's full-sized avatar

Josh Gilfillan jgilfillan

View GitHub Profile
@kitroed
kitroed / GenerateSqlScripts.ps1
Last active December 23, 2022 22:28
Generate a file-per-object representation of a given SQL Server database using PowerShell and SMO.
# Adapted from http://www.simple-talk.com/sql/database-administration/automated-script-generation-with-powershell-and-smo/
<#
.SYNOPSIS
Generate file-per-object scripts of specified server and database.
.DESCRIPTION
Generate file-per-object scripts of specified server and database to specified directory. Attempts to create specified directory if not found.
.PARAMETER ServerName