November 2018
Intermediate to advanced
566 pages
17h 15m
English
The sorting happens at the first line. Get-Content imports the name as an array of strings. At this point, the input object is an array. Sort-Object then sorts the elements in this object. From here on, the process is the same as the Accessing and manipulating array items recipe.
Of course, there are other ways to do this, one being to replace the last line of the script with the following:
$NewNames = $NewNames | Sort-Object
Read now
Unlock full access