大佬教程收集整理的这篇文章主要介绍了windows-server-2003 – Windows任务调度程序电子邮件通知?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这是Windows Server 2003上的Windows任务计划程序可以执行的操作吗?
# attempt to run your exe. iex is an alias for the invoke-expression cmd iex c:\path_to_exe\myprog.exe # $? lets us kNow if the prevIoUs command was successful or not # $LASTEXITCODE gives us the exit code of the last Win32 exe execution if (!$? -OR $LASTEXITCODE -gt 0) { $smtpServer = "smtp.mydomain.com" $fromAddress = "sender@mydomain.com" $toaddress = "recipient@mydomain.com" $subject = "FAIL" $msgBody = "HEY,YOU GOT PROBLEMS" # This block is optional depending on your SMTP server config # You need it if your SMTP server requires authentication $senderCreds = new-object System.Net.networkCredential $senderCreds.username = "senderusername" $senderCreds.password = "senderpwd" $smtpClient = new-object Net.Mail.SmtpClient($smtpServer) $smtpClient.Credentials = $senderCreds $smtpClient.Send($fromAddress,$toaddress,$subject,$msgBody) }
以上是大佬教程为你收集整理的windows-server-2003 – Windows任务调度程序电子邮件通知?全部内容,希望文章能够帮你解决windows-server-2003 – Windows任务调度程序电子邮件通知?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。