This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Export-SsisPackages | |
{ | |
[CmdletBinding()]param( | |
[parameter(ValueFromPipeline)] | |
[ValidateScript({Test-Path $_})] | |
[string]$OutputPath, | |
[string]$DatabaseServerName = ".", | |
[string]$SsisCatalogDatabaseName = "SSISDB" | |
) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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. |