Jump to content

Powershell Out-GridView not sorting columns as expected?


Recommended Posts

Posted

If you do

Get-Process | Sort-Object PM

Power shell outputs the list correctly sorted by pagable memory

Also if you pipe this to the gridview

Get-Process | Sort-Object PM | Out-Gridview

It displays as it should, but if you then sort for ascending\descending by selecting the column of PM(K) it doesn't sort it numerically?

 

'Handles' and 'Id' sort numerically but everythig else sorts as a string.

 

Is this a bug in the Powershell GridView or can anyone tell me why GridView displays this way?

Posted (edited)

I'm confused.com.... mine outputs as expected (sorted by PM) in gridview Windows 10 Pro 1703 (fully updated)

 

EDIT: Should have read your post a few times before replying. I didn't try clicking on the column heading to re-sort ASC/DESC. Same problem here, it seems to sort them by the first digit, rather than the whole number.

Edited by mrwoberts
I'm an idiot
  • Thanks 1
Posted (edited)

Strangely the sorting works properly (in Out-GridView) with this command...

 

Get-Process | Select-Object -Property Name, WS, PM, PeakWorkingSet | Sort-Object -Property PM -Descending | Out-GridView

Edited by Arthur
  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...