Functions/Get-LastLineFromArray.ps1

<#
    .SYNOPSIS
    Gets last line of a multi-line variabele
    .DESCRIPTION
    Gets last line of a multi-line variabele.
    Avoids [caution: ] message desturbing warnings.
    .EXAMPLE
    Get-LastLineFromArray -TextVariable $WarningText
    .PARAMETER TextVariable
    The array variable containing multi line information
#>


function Get-LastLineFromArray ()
{
    param
    (
        [parameter(Mandatory=$true)]
        [array] $TextVariable
    )
    PROCESS
    {
        foreach ($line in $TextVariable) 
            {
                $lastwarning = $line
            }

        return $lastwarning    
    }
}

Export-ModuleMember -Function Get-LastLineFromArray