PoshCode Archive  Artifact Content

Artifact b3035d479da29d6b1ac4163227b74c99772aaf74f9fa22f7cc21f9ef88aaaac7:

  • File format-example.ps1 — part of check-in [e09a25dd76] at 2018-06-10 13:01:10 on branch trunk — quick code example for a discussion on posting code. code lifted from http://sev17.com/2010/04/t-sql-tuesday-005-ssis-reporting/ (user: unknown size: 1431)

# 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}
        }
}