What's the output from the following:
PS C:\MyData> $mycsv = Import-Csv .\Source.csv
PS C:\MyData> $mycsv | Get-Member
EDIT: Its these you want to check:
Code:
PS C:\> $mycsv | Get-Member
TypeName: System.Management.Automation.PSCustomObject
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
[B]Name NoteProperty System.String Name=John
Number NoteProperty System.String Number=21[/B]
That is the property it will try and sort on, not sure why yours isn't sorting. Mine:
Code:
PS C:\> $mycsv | Sort-Object -Property Name -Descending
Number Name
------ ----
100 Steven
89 Michael
43 Mark
21 John
1 Ellen
2 Ed