Workflow Notification - Capture PowerShell error

Hi Team. 

I have a Workflow that is running a Powershell script and then when its done it sends off a notification rule. 

Is it possible at all to capture parts of the Output to use in the eMail notification? I would like to send an email to the person running the Workflow so they can see that 

The PnP Teams site exists with the given display name or mail nickname.

if ((Get-PnpTeamsTeam -Filter "DisplayName eq '$TeamName'" -ErrorAction SilentlyContinue) -or (Get-PnpTeamsTeam -Filter "MailNickname eq '$TeamNickName'" -ErrorAction SilentlyContinue))
{
    Write-Output "The PnP Teams site exists with the given display name or mail nickname." | Out-File $logfile -Append
}
else
{


try
{
New-PnPTeamsTeam @TeamsProperties | Out-File $logfile -Append
}
catch
{

# Write a message into the AR Server event log

$EventLog.ReportEvent($Constants.EDS_EVENTLOG_WARNING_TYPE, ("Problem with New-PnPTeamsTeam" + $Error[0]))
}

}
}

Top Replies