PowerShell is a powerful tool that allows you to gather a large amount of data quickly and easily. A lot of times the output is spit back in a manner that is not so easy to read. Thankfully there are options available to format the output of the data.
In a previous article I showed a sample command called Get-Process which retrieved all the running processes and listed them alphabetically. Sure that might be good enough for you, but you have options. MSH includes a switch called format-list and format-table which allow you to create lists and tables of the data being output.
Get-Process | format-list
Or if you prefer your data in a table format, try this command.
Get-Process | format-table
Now you might look at that last example and say "Hey, that looks the same as the default output!". Well you are right, but here is where we can really customize the formatting.
Get-Process | format-table -groupby ProcessName
Now you can see the formatting start to come together. Let's look at one more example.
Get-Process | sort-object Id | format-table -GroupBy ProcessName
The difference in this last example is subtle, but if you look closely the data is listed by Id before being formatted into a table. These examples give you a glimpse into what formatting options you have with MSH, the power is there, you just need to harness it! Want to expand on these examples? Try the following command and see where it takes you!
Get-Command Format-*