Fail SSIS "Execute Process Task" if false is returned I have an "Execute Process Task" that calls Powershell and checks if a folder is empty. I'm wanting the SSIS job to fail if $false is returned.

Here is the code

param ([string] $FolderLocation)

$FolderLocation = 'C:\Temp\IsFolderEmpty\'

if( (Get-ChildItem $FolderLocation | Measure-Object).Count -eq 0)
{
    #Folder Empty
    return $true

} Else {

    return $false

} 


Any time I run this in SSIS, it always runs whether $true or $false is returned. I've tried creating a new variable and using it in the StandardOutputVariable but haven't had any luck.
Try using a Script Task to check the value of the SSIS variable that is set as the StandardOutputVariable of the Execute Process Task.  If this value is false the Dts.Events.FireError method raises an error event that can be used to fail the package.  The code below is an example of this using C#, where an error is raised when the variable is false.  The SSIS variable will need to be set in the ReadOnlyVariables field of the Script Task to allow it to be accessed.

    if (!Convert.ToBoolean(Dts.Variables["User::YourVariable"].Value))
    {
        Dts.Events.FireError(0, "Error", "Error Raised from Folder Check", null, 0);
    }