A Microsoft platform for building enterprise-level data integration and data transformations solutions.
Instead of using an Execute Process Task to run your powershell script - I suggest you use a script task and execute the powershell script in that task. This will give you the ability to control what happens when you get an error from that script.
Here is an example of calling out to Powershell from a C# script task. You can add a try/catch to this to capture any errors - and return a specific error message as needed.
using (PowerShell PowerShellInstance = PowerShell.Create())
{
string zipArchive = Dts.Variables["User::FullFileName"].Value.ToString();
string rootDirectory = Dts.Variables["$Project::RootDirectory"].Value.ToString();
// use "AddScript" to add the contents of a script file to the end of the execution pipeline.
// use "AddCommand" to add individual commands/cmdlets to the end of the execution pipeline.
PowerShellInstance.AddScript("param($zipArchive, $destinationFolder) " +
"Add-Type -assembly System.IO.Compression.FileSystem; " +
"[io.compression.zipfile]::ExtractToDirectory($zipArchive, $destinationFolder)");
PowerShellInstance.AddParameter("zipArchive", zipArchive);
PowerShellInstance.AddParameter("destinationFolder", rootDirectory);
// invoke execution
PowerShellInstance.Invoke();
}
In this example - I am building the script in the code...if you have a script file built already - you can call out to that script, however - I would pull that code into the script task to keep everything in one place and easily modifiable. Either way...you can control what happens when it fails.