We have a server running our backup software, and the software has its own event log. I can retrieve the most recent event log entry with this command:
Get-EventLog EventLogName -ComputerName server.example.com -newest 1
That gives me results like this:
Index Time EntryType Source InstanceID Message
----- ---- --------- ------ ---------- -------
64292 Aug 13 15:51 Information BackupSoftware 29593 Transfer of 1096 KB...
What I'd like to do is trigger an action (say, launch a second script) if the timestamp of the most recent event is older than one hour.
Any help would be appreciated.
Best Answer
That will find the most recent event in the Application log with a Source of "BackupSoftware".
That will find the most recent event in a custom log named BackupSoftware regardless of source or EventId.
In both cases, the script will
Do-Stuff
if the event is more than an hour old.