Public/ps1/Configuration/Stop/Stop-ApprxJob.ps1

<#
    .SYNOPSIS
    Stops a running Apprxr job by name.
 
    .DESCRIPTION
    Finds and stops jobs whose names contain 'Apprxr' using the provided task information. Logs the action and removes the job from the job list.
 
    .PARAMETER taskInformation
    An object containing the job name to stop.
 
    .EXAMPLE
    Stop-ApprxrJob -taskInformation @{ name = 'Job1' }
 
    .NOTES
    Used for stopping and cleaning up Apprxr jobs by name.
#>

function Stop-ApprxrJob{
    param($taskInformation)

    $runningProcesses = get-job ($taskInformation.name)

    $runningProcesses | %{
    
        if ($_.Name.Contains("Apprxr")) {
            Log ("Stopping job :" + $_.Name)
            Stop-Job $_.Name
            Remove-Job $_.Name
        }
    }
}