Skip to content

Instantly share code, notes, and snippets.

Created March 29, 2013 03:28
Show Gist options
  • Save anonymous/5268578 to your computer and use it in GitHub Desktop.
Save anonymous/5268578 to your computer and use it in GitHub Desktop.
Beginnings of a PowerShell script to examine all the SSIS packages on the file system and spit out their properties.
[Reflection.Assembly]::LoadWithPartialName("Microsoft.SQLServer.ManagedDTS") | out-null
$inputPath = "C:\Users\bfellows\Documents\Visual Studio 2008\Projects\QuickDemo\QuickDemo"
$fileMask = "*BlueFeet.dtsx"
$app = New-Object Microsoft.SqlServer.Dts.Runtime.Application
foreach($file in [System.IO.Directory]::GetFiles($inputPath, $fileMask))
{
$package = $app.LoadPackage($file, $null)
Write-Host
Write-Host "-".PadLeft(80, "-")
Write-Host "Package Name: $file"
Write-Host "-".PadLeft(80, "-")
Write-Host
if ($package.Configurations.Count -gt 0)
{
Write-Host "Configurations"
Write-Host "-".PadLeft(80, "-")
}
foreach($config in $package.Configurations)
{
$x = [string]::Format("{0}|{1}|{2}|{3}|{4}", $config.ConfigurationType, $config.Name, $config.PackagePath, $config.ID, $config.ConfigurationString)
Write-Host $x
}
Write-Host
if ($package.Connections.Count -gt 0)
{
Write-Host "Connections"
Write-Host "-".PadLeft(80, "-")
}
foreach($cm in $package.Connections)
{
#http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.connectionmanager.aspx
$x = [string]::Format("{0}|{1}|{2}|{3}", $cm.CreationName, $cm.Name, $cm.HostType, $cm.ConnectionString )
# Getting no love on the expressions showing
#$exp = [string]::Format("HasExpression {0}.", $cm.HasExpression)
#Write-Host $exp
Write-Host $x
#Use this to expose information about the specific properties of the connection manager.
#foreach($prop in $cm.Properties)
#{
# Write-Host ([string]::Format("{0}|{1}|{2}", $prop.Name, $prop.Type, $prop.GetPackagePath($package)))
#}
Write-Host
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment