Solved

powershell script help

Posted on 2014-10-31
3
108 Views
Last Modified: 2014-10-31
I found a wonderful report online that emails me a daily report of all of my servers. Currently the report will show me the last 10 Errors and Warnings from the System event log for each server.

I would like this report to only show me these events (if any) from the last 24 hrs... but I have no idea how to edit the script to do so.

Can someone help me out?
SystemReport.txt
0
Comment
Question by:ashleyandy
  • 2
3 Comments
 
LVL 16

Expert Comment

by:Rajitha Chimmani
ID: 40416157
Find attached the modified script. This will allow you to pull the list for last 24 hours. You can also modify the script to number of hours you would like to go back by changing the the value at the below line in the code.

[int]$Hours = 24
SystemReportHours.txt
0
 
LVL 28

Assisted Solution

by:becraig
becraig earned 250 total points
ID: 40416163
Make the following changes in lines 184 & 199 :


	$SystemEvents = Get-EventLog -ComputerName $computer -LogName System -EntryType Error, Warning -After (Get-Date).AddDays(-1)

Open in new window


	$ApplicationEvents = Get-EventLog -ComputerName $computer -LogName Application -EntryType Error, Warning -After (Get-Date).AddDays(-1)

Open in new window



We're making the change to look for one day back:
-After (Get-Date).AddDays(-1)

Open in new window

0
 
LVL 16

Accepted Solution

by:
Rajitha Chimmani earned 250 total points
ID: 40416171
I missed something in my last attachment. Here is the final one.
SystemReportHours.txt
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Utilizing an array to gracefully append to a list of EmailAddresses
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now