How to count objects in PowerShell?
This will get you count: get-alias | measure You can work with the result as with object: $m = get-alias | measure $m.Count And if you would like to have aliases in some variable also, you can use Tee-Object: $m = get-alias | tee -Variable aliases | measure $m.Count $aliases Some more info on Measure-Object … Read more