I'm not sure how I was supposed to tease it out of the help for Sort-Object, but you can apparently just put in a script-block for Sort-Object that'll operate on each object in an array just like any other pipeline function. Painfully difficult to google up, for some reason, though I eventually found it here:

So if I have an array of hashtables called $ahash, and each hashtable in $ahash has a property called `name`, I can just do this...

$sorted = $ahash | Sort-Object { $_.name };
$sorted | % { $_.name };


Maybe that's in the help, but I didn't see it. There some script block stuff described under `-Property<Object[]>`, but that's specifically for the Property param, which isn't exactly what I think we want. Lots easier than writing an IComparer and .NETting around your elbow to get back to your nose. /shrug

(I don't know why the p tags are so goofy in this post.)

Labels: ,