PowerShell Trivia #1
I was playing around with Get-Command the other day and started wondering which were the most commonly used verbs and nouns in the default install of PowerShell 2.0.
If you guessed that “get” was the most common verb – 5 points
Test it by using
get-command -commandtype cmdlet | group verb | sort count -Descending | select -First 1
Now for 10 points what’s the most common noun
I had to think about this one a bit but the answer is given by
get-command -commandtype cmdlet | group noun | sort count -Descending | select -First 1
which tells us that “object” is the most common.
Guess what – there isn’t a Get-Object cmdlet!
These are trivial pieces of data but the important point is look how I arrived at the results. Four cmdlets strung on the pipeline. Including grouping and sorting functionality that you would need to write your self in other scripting languages. Now we know where the Power comes from.