In the previous tip we showed that Sort-Object accepts property names, hash tables or plain script blocks to sort things. Let’s check out why submitting script blocks to Sort-Object can be a good idea.
Let’s assume you have a bunch of string data that represents dates, and you’d like to sort them:
PS> 'May 12, 2020', 'Feb 1, 1999', 'June 12, 2021' | Sort-Object
Feb 1, 1999
June 12, 2021
May 12, 2020…