Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Powershell task fails but task doesn't fail

$
0
0
I have created a SSIS package and one of the steps is a Execute Process task that runs a PS script.  The problem I am having is that the PS script will fail but the task will show successfully.  Any ideas on how to capture the error, so the package will fail if the PS script fails?
PARAM([string]$SelectedFolder)

function Remove-Diacritics {
param ([String]$src = [String]::Empty)
  $normalized = $src.Normalize( [Text.NormalizationForm]::FormD )
  $sb = new-object Text.StringBuilder
  $normalized.ToCharArray() | % {
    if( [Globalization.CharUnicodeInfo]::GetUnicodeCategory($_) -ne [Globalization.UnicodeCategory]::NonSpacingMark) {
      [void]$sb.Append($_)
    }
  }
  $sb.ToString()
}

$filepath = "\\fileserver\groups\CommonApp SDS files\Test Data\" + $SelectedFolder + "\*.txt"


Get-ChildItem $filepath | foreach {(Get-Content -encoding utf8 $_) | Foreach-Object {Remove-Diacritics $_} | Set-Content $_ -encoding ascii}


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>