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}