Link to home
Start Free TrialLog in
Avatar of dfke
dfke

asked on

Powershell get dates from log file, compare with current date and set an alert/e-mail notification

Hi,

I have a log file with output in the following format. I put xxxxxxxx because the log contains sensitive data.
There are multiple sections like this one and all are separated by a blank line.

I wish to receive an e-mail/set an alert when if any of the dates in the log are more than 24 hours ago. Just trying to figure out how to read and compare the dates with the current date.

xxxxxxxx                                            : xxxxxxxx
xxxxxxxx                                            : xxxxxxxx
xxxxxxxx                                            : xxxxxxxx
xxxxxxxx                                            : 1/14/2020 5:30:08 AM
xxxxxxxx                                            : 1/14/2020 5:30:06 AM
xxxxxxxx                                            : 1/14/2020 5:30:04 AM
xxxxxxxx                                            : 1/14/2020 5:30:08 AM

Open in new window


If anyone can get me in the right direction if would be very much appreciated.

Cheers
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dfke
dfke

ASKER

Hi oBdA,

That's perfect! Thanks for your quick reply!

Cheers