
Sal Gallagher (ARMY-AMC) asked a question.
I have a PowerShell script that checks for website availability and run it from a task. How do I pass the results to an email?
The script runs by it self with the correct status code and message with website up or down. I have a task that runs the script. How do I send an email with the correct message? I have it setup with on success or on failure, send the correct email message. However, since the script runs successfully with website up or down, it will only email on success. How do I send the email that its down?
obligatory unhelpful forum response: "why are you monitoring a website with file transfer software? you could just run a windows scheduled task on any server anywhere."
with that out of the way:
in the powershell script:
$mySiteStatus= [whatever the result of your powershell website test is]
$miaclient.MISetTaskParam("SiteStatus",$mysitestatus) #sitestatus is the parameter name we're passing to the task
in the moveit task, call the new parameter with [parm:(parametername)] syntax:
if [parm:sitestatus] matches "[whatever the bad/down value is from your script]"
--send email