Hello,
Do we understand correctly that the script you referenced and the Send email notification action will be executed in the same Scheduled Task? If that is correct, there is no possibility to pass the $customattrib variable value to the action. You will need to send the notification right in the script itself. Finally, it will look like the following:
$software = "Microsoft Office Professional Plus 2016"
$installed = Get-WmiObject -ComputerName %cn% -Class Win32Product | sort-object Name | Select-Object Name | Where-Object {$.Name -eq $software}
if (-not $installed)
{
$customattrib = " %cn% - $($installed.name) not installed"
}
else
{
$customattrib = " %cn% - $($installed.name) installed"
}
# Send mail
$Context.SendMail("recipient@company.com", "Office 2016", $customattrib, $Null)