I am new to PowerShell and if/else statements. I've tried this so far in PowerShell without it working.
Basically: I want it to send a mail when the JobState = Failed from get-wbjob -previous 1. When the JobState = Completed it should do nothing.
if(get-wbjob -previous 1 -State Failed){
Send-MailMessage -From 'mail@domain.com' -To 'mail@domain.com' -Subject '$env:UserDomain' -Body '$Backup' -SmtpServer smtp.server.com
}else{
}
Aucun commentaire:
Enregistrer un commentaire