tiistai 30. syyskuuta 2014

Checking Event Viewer logs for errors. Now made easy with Powershell!

Hi there,

I recently picked up my old Powershell skills because I needed to automate a process so I could keep doing as little work as possible.

You see, the company I work for requires a lot of reports and as you might know managers love their reports, am I right or am I right folks!

My job mostly revolves around checking if everything is A O.K with our customers servers/systems.
Now what's the problem here, you might think? Well! The problem is that I have to go through every. Single. Freaking servers Event Viewer to see if they are having issues and save the logs in a repository if a situation might arise were we might need them.As you might have figured out by now, this all takes a lot of time to do.

So as a lazy person that I am. I decided to tackle this problem by at first creating a short script that shows me exactly 600 of the newest errors in event logs. This is what I came up with:


Simple huh? Just copy paste this bugger in your Powershell and you should get  to see the 600 newest event viewer errors.
This is how it should look like.
Please note that you should at all times, if possible, run powershell as administrator to make sure that the script runs smoothly.

If your shell gives you an error when pasting the lines to the command promt it simply means that you a) got an extra letter some where in the code b) you didn't run the powershell as Admin! OR c) There is nothing to find aka. no errors.
I didn't remember to run PS as admin and now it nags me about access rights.
Next time: I will teach you how to tame a lama!

Ei kommentteja:

Lähetä kommentti