We help IT Professionals succeed at work.
Get Started

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

dfke asked
1 Endorsement
Last Modified: 2020-01-14

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.

Watch Question
Most Valuable Expert 2019
Most Valuable Expert 2018
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE