WARNING: Cmdlet did not return any records in the log file. Check your time range or filters. Merge-SPLogFile


Hi everyone! Just a quick tip regarding this message. I am on a customer and found that not always the command will returns data and had to check it more carefully.

Symptom

Suppose you swear you know that there are some log related to the filter you have put - say a Correlation ID - but after you execute the following command:

Merge-SPLogFile -Path C:\temp\ErrorJob.log -Correlation "84FC629D-03AF-A09C-2AC2-C59A1650BB9E"

You receive the message

WARNING: Cmdlet did not return any records in the log file. Check your time range or filters.

And you just stare at the message knowing that it is a LIAR! How to teach it who's the Boss?

Reason

This is because normally Merge-SPLogFile haven't found any log in the most recent files (my assumption is that it only check the latest ULS files) so you need to provide the date filter.

Solution

Instead of just asking for the Correlation ID, provide a date filter, the narrower the time span is, the faster it will execute:

Merge-SPLogFile -Path C:\temp\ErrorJob.log -Correlation "84FC629D-03AF-A09C-2AC2-C59A1650BB9E" -StartTime "2/26/2016 12:00:00" -EndTime "2/23/2016 15:00:00"

Violà!

You now won't see the message and will have your beloved trimmed log.

Enjoy!


Comments (0)

Skip to main content