Sorting PowerShell versions

Just convert it to a Version and sort that way:

$list = "3.0.1.1","3.2.1.1" 
$sorted = $list | %{ new-object System.Version ($_) } | sort

PS C:\> $ver="3.0.1.1","3.2.1.1"
PS C:\> $ver|%{[System.Version]$_}|sort

Major  Minor  Build  Revision
-----  -----  -----  --------
3      0      1      1
3      2      1      1

A version string can be cast to a Version object, and sort-object can be passed a script block and sort on the result.

PS C:\Users\me> "3.11.0.1", "3.0.1.1", "3.2.1.1" | sort
3.0.1.1
3.11.0.1
3.2.1.1

PS C:\Users\me> "3.11.0.1", "3.0.1.1", "3.2.1.1" | sort {[version] $_}
3.0.1.1
3.2.1.1
3.11.0.1

(Added an extra version string to make the example actually meaningful.)