Skript, mis leiab application log'ist viimase nädala joosul tehtud "Error" tüüpi kirjed ja edastab need administraatorile e-kirjana Powershell

From ICO wiki
Revision as of 09:43, 13 May 2011 by Htahis (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


<source lang="powershell"> Get-EventLog -logname application -EntryType error -newest 25| convertto-html > applogs.html $filename = “applogs.html” $smtpServer = “mail.uninet.ee”

$msg = new-object Net.Mail.MailMessage $att = new-object Net.Mail.Attachment($filename) $smtp = new-object Net.Mail.SmtpClient($smtpServer)

$msg.From = “application@logid.com” $msg.To.Add(”email.email@gmail.com”) $msg.Subject = “Application errorlogs” $msg.Body = “Viimased 25 Application error logi” $msg.Attachments.Add($att)

$smtp.Send($msg)