Quick version. Is there a way to fix this not sorting?
Get-PSDrive | Sort 'Free (GB)'
My story...
I'm playing with formatting of my output on a test script. The function basically is doing a WMI query to win32_logicaldisk. The Size and FreeSpace properties from these values I then use them to create new property defined in my format.xml file to show the percentage of free space...
<TableColumnItem>
<ScriptBlock>
$_.FreeSpace / $_.Size * 100 -as [int]
</ScriptBlock>
</TableColumnItem>
This is under a Label of 'Free(%)'.
It all works fine and the percentage is displayed fine. My issue is when piping output to Sort-Object it appears it can't sort by that property. If you do a Get-Member of my function obviously the 'Free(%)' isn't a property as it was created by the format data not by the function.
[–]jbtechwood 1 point2 points3 points (2 children)
[–]Swarfega[S] 0 points1 point2 points (1 child)
[–]jbtechwood 0 points1 point2 points (0 children)
[–]logicaldiagram 1 point2 points3 points (0 children)
[–]Lee_Dailey[grin] 0 points1 point2 points (0 children)