Finding cmdlets that already have aliases is really easy. You can use the Get-Alias cmdlet to find them.
gal | select definition –unique
# “Gal” is an alias for Get-Alias. “Select” is an alias for Select-Object
If you want to speed up your time at the console, you should consider finding ways to type less. That can be done by creating aliases. There are already a lot of aliases, but here’s how to find all the cmdlets that do not yet have an alias.
Get-Command –commandtype cmdlet | Where-Object { !(Get-Alias –Definition $_.name –erroraction silentlycontinue) }
# or, the same thing using aliases
gcm –commandtype cmdlet | ? { !(gal –definition $_.name –ea silentlycontinue)}
If you store the results in an array called $noAlias we can easily do things like “find how many cmdlets have no alias”
$noAlias.length
133
That’s 133 cmdlets with no alias. Ripe for the picking. How about the 3 cmdlets with no alias that are the longest to type? Here they are:
$noAlias | sort –des {$_.name.length} | select name –first 3
Name
—-
Unregister-PSSessionConfiguration
Register-PSSessionConfiguration
Disable-PSSessionConfiguration
Or instead of the longest names, here are the types of objects to perform actions on (the nouns) that may benefit from having more aliases.
$noAlias | group noun | sort –des count | select count, name –first 5
Count Name
—– —-
7 EventLog
6 PSSessionConfiguration
6 Computer
5 Transaction
5 Event
So there you have it. You now can see lots of places where you can further streamline your console commands by creating aliases for cmdlets that don’t have them.