Sort Array of objects

mikeydk
mikeydk used Ask the Experts™
on
Hey

(Powershell)

I have an array contaning:

Computer Date
PC1             01-02-2012
PC2             02-04-2012
PC3             01-03-2013

I need to get the 2 oldest computers returned.

Howto?

Mike
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2018
Distinguished Expert 2018
Commented:
$array | Sort-Object -Property Date | Select-Object -First 2

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial