0

I'm trying to create a PowerShell Cmdlet that runs daily and shows me the errors that occured on the previous day.

I can make it show the last 100. Instead I'd like to see just the one that occured the day before.

get-eventlog 
 -logname application 
 -newest 100 | 
 select eventid,machinename,entrytype,message,source,timegenerated,username | 
 export-clixml C:\Logs.xml
3
  • 1
    The instructions for get-eventlog are available at technet.microsoft.com/en-us/library/hh849834.aspx and fully answer your question. Commented Oct 18, 2013 at 15:16
  • Which one do you want it to show?
    – Colyn1337
    Commented Oct 18, 2013 at 15:16
  • the event for the day @ChrisInEdmonton i want it to get within a time period of 1 day. i'd previously that article and it didn't help.
    – Zigmaphi
    Commented Oct 18, 2013 at 15:22

1 Answer 1

5

This PowerShell command will return the event logs for the previous 24 hours:

Get-EventLog Application -After (Get-Date).AddDays(-1)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .