Research and Development
The whoami.exe
is a useful little tool that ships with Windows 7/Server 2008 R2, and it becomes even more useful when you instruct it to output its result in CSV format.
PowerShell can pick up CSV data and turn it into rich objects:
PS> whoami /ALL /FO CSV | ConvertFrom-CSV | Sort-Object UserName