keskiviikko 1. lokakuuta 2014

How to Generate a simple html report for your Event Viewer logs

In my last Powershell blog I showed how I created a small simple script to get the event viewer logs on one go for easy viewing. After short study I convinced my self that I should make my life much easier and automate the whole event viewer log monitoring process.

I needed this script to do the following:
  • show me the last 600 error and audit failure messages from Application, Security and System -event-logs.
  • Input all the data in one simple html table and put out a file that I can open in any browser.
  • Rename the created .htm file for each log to read ass (log name)(date).htm.
  • Backup the event-logs to a designated Logs -folder.
  • Rename said logs so that they have the date of the backup in their names for easier access if needed.
  • Clear the logs out.
Now this was not an easy task as I am not by far a proficient PS user but just a novice creating his new script, but in the end I got it working and I have to say I am pretty darn proud of my little creation. Just save it as a .ps file and use task scheduler to run it. It's simple as that.

Now the only problem I had left was that I still had to remote connect to every. single. server our customers had in our monitoring system. What a bother...

So I came up with a script to email reports or files using a custom gmail account.

The only problem that remains is that to make this script work on every server is that it needs to be also run on every freaking server...

So here is the to do for the script before I can relax even more and let the computer do all my stuff.

  • Modify the evt-script so that it now add's the server name in the report with the date.
  • Save the report to a network drive located on a dc.
  • Figure out how to create a .zip file with Powershell. Research possibilities of running winzip with task scheduler or other methods.
  • Set up the email script to grab the .zip file, attach it and send to our helpdesk.
That is all for now folks.

Next time: We go to the MOON!


Ei kommentteja:

Lähetä kommentti