Greetings!
Got a PS task that sometimes "hangs". Only this task got this issue
Task AND job got a timeout settings set to 1 minute, but it's not working. It's impossible to stop the task - only by VisualCron service restart.
User that runs visualcron jobs doesnt have an active PS process when task hangs.
Code (mb this will help):
if ((Get-Service -ComputerName "bigtn12" "Rabbit TB Service").status -eq "Running")
{exit}
else {Send-MailMessage -From "VisualCronAlerts <VisualCronAlerts@berg.ru>" -To
helpdesk_it@berg.ru,
it_robot@berg.ru -Subject "Служба Rabbit TB Service не в состоянии 'Running', перезапустите службу" -Body (((Get-Service -ComputerName "bigtn12" | Where-Object {$_.name -eq "Rabbit TB Service"} | out-string)) + "Это письмо генерируется заданием 'Проверка статуса службы RabbitTBService' в планировщике заданий VisualCron на сервере Bigtn11.") -SmtpServer mail.brg.loc -Encoding ([System.Text.Encoding]::UTF8) }
exit