Skip to content

Instantly share code, notes, and snippets.

@bseebacher
bseebacher / Export-SsisPackages.ps1
Last active February 14, 2024 23:01
Exports all SSIS projects and packages from a SQL Server 2012 and above SSISDB catalog.
function Export-SsisPackages
{
[CmdletBinding()]param(
[parameter(ValueFromPipeline)]
[ValidateScript({Test-Path $_})]
[string]$OutputPath,
[string]$DatabaseServerName = ".",
[string]$SsisCatalogDatabaseName = "SSISDB"
)
@bseebacher
bseebacher / VarbinaryToFile.ps1
Last active September 26, 2017 02:39
Example of writing varbinary(MAX) return of [catalog].[get_project] to file.
$cmdExport = New-Object System.Data.SqlClient.SqlCommand
$cmdExport.Connection = $catalogDbConnection # Open connection to SSISDB
$cmdExport.CommandText = "[catalog].[get_project]"
$cmdExport.Parameters.AddWithValue("@folder", "<your SSIS Folder Name>") | Out-Null
$cmdExport.Parameters.AddWithValue("@project", "<your SSIS Project Name") | Out-Null
# Use ExecuteScalar() method to get a cursor to read varbinary(MAX) return.
$bReader = $sqlCommand.ExecuteScalar()
# WRITING OUTPUT
# Use the WriteAllBytes static method on the .NET System.IO.File class
# for writing bytes to disk at provided path.