badano Posted February 27, 2008 Share Posted February 27, 2008 Någon som vet något bra enkelt program "Free" för att skicka varningarna från Event viewer via mail /Danne Ämnet redigerat av stenis, har förtydligat ämnet/rubriken Quote Link to comment Share on other sites More sharing options...
Andreas Stenhall Posted February 27, 2008 Share Posted February 27, 2008 Windows Server 2008 och Vista har ju detta inbyggt Dags att uppgradera med andra ord om du inte redan kör det ;D Quote Link to comment Share on other sites More sharing options...
Venoms Posted February 27, 2008 Share Posted February 27, 2008 Visst kan du det... så här ungefär... '************************************************ ' File: Outlook.vbs ' Author: Anders Pettersson ' ' This script creates a new e-mail entry with attachement in Outlook. ' ' ' ' In no way shall the author be liable for any ' losses or damages resulting from the use of this ' program. Use AS-IS at your own risk. ' ' The code is the property of the author. You may ' use the code and modify it, as far as this header ' remains intact. '************************************************ ' Option Explicit Const olMailItem = 0 ' Constants for new items Const olAppointmentItem = 1 Const olContactItem = 2 Const olTaskItem = 3 Const olJournalItem = 4 Const olNoteItem = 5 Const olPostItem = 6 Dim objOutl, objNameSpace, objMailItem, objAttachments Dim recipient, message, subject ' define the items for the e-mail recipient = "info@itpoolen.se" subject = "Subject: System Log" message = "System log från servern" ' Create Outlook object reference Set objOutl = WScript.CreateObject("Outlook.Application") ' obtain an object reference to "Mapi" name space Set objNameSpace = objOutl.GetNameSpace("MAPI") ' create a new mail item object Set objMailItem = objOutl.CreateItem(olMailItem) Set objAttachments = objMailItem.Attachments objAttachments.Add "C:WindowsSystem32configSysEvent.Evt" ' set the mail object properties objMailItem.Recipients.Add recipient ' E-mail address objMailItem.Recipients.Add "itpoolen@gmail.com" ' 2nd recipient objMailItem.Subject = subject ' subject objMailItem.Body = message ' the body text ' now we are ready to "logon" to outlook (using Logon method) objNameSpace.Logon "profile", "password" objMailItem.Send ' send method objNameSpace.Logoff ' logoff WScript.Echo "E-mail created for " & recipient ' Post ready message WScript.Quit() ' End Kopiera och klistra in i ett textdokument, spara som t.ex outlook.vbs Filen är ganska självförklarande, du får naturligtvis byta ut epostadresserna. Detta script skickar event filen med epost... Sedan kan du, om du vill göra ett script som kontrollerar om en fil ändrats... --- BEGIN OF FILEMODIFICATIONCHECK.VBS --- Option Explicit Const retvalUnknown = 1 ' /////////////////////////////////////////////////////////////////////////////// Function FileModificationCheck( strFile, strLogFile ) ' Option Explicit Dim strPrevModDate, strCurrModDate FileModificationCheck = True strPrevModDate = Trim( ReadInfo( strLogFile ) ) strCurrModDate = Trim( GetFileModDate( strFile ) ) If( strCurrModDate = "" ) Then FileModificationCheck = retvalUnknown SYSEXPLANATION = "File does not exist" SYSDATA = "" Exit Function End If ' Write current date/time info, to be used in next call of FileModificationCheck WriteInfo strLogFile, strCurrModDate If( strPrevModDate = "" ) Then FileModificationCheck = True ' First time consider file as: not changed SYSEXPLANATION = "File has not changed (first time)" SYSDATA = "" Exit Function End If If( strPrevModDate = strCurrModDate ) Then FileModificationCheck = True ' First time consider file as: not changed SYSEXPLANATION = "File has not changed" SYSDATA = strCurrModDate Exit Function End If FileModificationCheck = False SYSEXPLANATION = "File has changed" End Function ' ///////////////////////////////////////////////////////////////////////////// Function GetFileModDate( strFile ) On Error Resume Next Dim fso, fsoFile GetFileModDate = "" Set fso = CreateObject("Scripting.FileSystemObject") Set fsoFile = fso.GetFile( strFile ) GetFileModDate = fsoFile.DateLastModified End Function ' ///////////////////////////////////////////////////////////////////////////// Function WriteInfo( strLogFile, strInfo ) On Error Resume Next Dim fso, fsoFile, fsoStream Set fso = CreateObject("Scripting.FileSystemObject") If Not fso.FileExists( strFile ) Then fso.CreateTextFile( strLogFile ) End If Set fsoFile = fso.GetFile( strLogFile ) Set fsoStream = fsoFile.OpenAsTextStream(2) ' 1=reading, 2=writing, 8=appending, fsoStream.WriteLine( strInfo ) fsoStream.Close End Function ' ///////////////////////////////////////////////////////////////////////////// Function ReadInfo( strLogFile ) On Error Resume Next Dim fso, fsoFile, fsoStream ReadInfo = "" Set fso = CreateObject("Scripting.FileSystemObject") Set fsoStream = fso.OpenTextFile( strLogFile, 1, false ) ReadInfo = fsoStream.ReadLine fsoStream.Close End Function --- END OF FILEMODIFICATIONCHECK.VBS --- Kör det sista scriptet, den som söker efter en ändring, som en service Quote Link to comment Share on other sites More sharing options...
badano Posted February 28, 2008 Author Share Posted February 28, 2008 Tack men jag söker något bra software till att skicka varningarna via SMTP. hittade en programvara http://www.file-monitor.com/almplus.html problem är att den inte går som service lite jobbigt om man loggar ur servern hmm det blir väl att vi får köra MOM /Danne Quote Link to comment Share on other sites More sharing options...
Venoms Posted February 28, 2008 Share Posted February 28, 2008 Du kan köra script som service... och om du t.ex kör ett script som kollar event, efter förändringar. När förändring sker så aktiveras outlook-scriptet som sänder iväg ett mail till dig med en kopia av loggen. Nästa gång som förändring sker, får du en ny kopia av loggen... Om man gör så behövs inga extra program för det... Quote Link to comment Share on other sites More sharing options...
badano Posted February 29, 2008 Author Share Posted February 29, 2008 Ok Tack vi provar med det /Danne Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.