# encoding: ascii
# api: powershell
# title: format example
# description: quick code example for a discussion on posting code.  code lifted from http://sev17.com/2010/04/t-sql-tuesday-005-ssis-reporting/
# version: 0.1
# license: CC0
# x-poshcode-id: 1780
# x-archived: 2010-04-17T07:51:45
#
#
#original good for internal use
$packages = dir "C:\Program Files\Microsoft SQL Server\100\DTS\Packages\*" | select -ExpandProperty Fullname | foreach {get-ispackage -path $_ }
$packages | foreach {$package = $_; $_.Configurations | Select @{n='Package';e={$Package.DisplayName}}, Name,ConfigurationString}
$packages | foreach {$package = $_; $_.Connections | Select @{n='Package';e={$Package.DisplayName}}, Name,ConnectionString}

#Cleaned up for public consumption
$packages = Get-ChildItem -Path "C:\Program Files\Microsoft SQL Server\100\DTS\Packages\*" | 
    Select-Object -ExpandProperty Fullname | 
        ForEach-Object {
            get-ispackage -path $_ 
        }
foreach ($package in $packages)
{
    $package.Configurations | 
        Select-Object -Property Name, ConfigurationString, @{
            Name='Package'
            Expression={$Package.DisplayName}
        }
}
foreach ($package in $packages)
{
    $package.Connections | 
        Select-Object -Property Name, ConfigurationString, @{
            Name='Package'
            Expression={$Package.DisplayName}
        }
}
