Below is part of my script. I just wanted someone to tell me if this should work in Orion. It currently works fine from the polling engine machine from within Powershell ISE, however, I can never get it to work in a component monitor. It is set for Local Host execution mode and the credentials does have access as it is in the local admins group.
if ($count -eq 0)
{
Write-Host Message: "There are no outstanding certificate expirations that are $reminderDays days out.";
Write-Host "Statistic: 0";
Exit 0;
if (test-path -path c:\scripts\messagebody.txt)
{
#Remove-Item -Path c:\scripts\messagebody.txt #-WhatIf
}
}
Else
{
$finalContent = Get-Content -Path c:\scripts\messagebody.txt
#Remove-Item -Path c:\scripts\messagebody.txt #-WhatIf
Write-Host "Message: $finalContent";
Write-Host "Statistic: 1";
Exit 1;
}