TOP 10 Commandlets in a Oneliner

“It’s the time for lists”, I read somewhere today. Sure, that is true. But blogging little lists isn’t much fun.

So, I will let you generate your very own TOP 10 list. Use the following Powershell Oneliner to get a TOP 10 list of your most frequently used cmdlets in your scripts. (Remember to modify the path to your script storage location.)

Happy Holidays!

Get-ChildItem D:Scripts -Filter *.ps1 -Recurse |
 Select-String (Get-Command|%{$_.Name}) |
 Group Pattern |
 Sort Count -Descending |
 Select -First 10 |
 Format-Table Name, Count -AutoSize

One thought on “TOP 10 Commandlets in a Oneliner

  1. Very fun! And interesting! I don’t have many scripts, so my numbers are low, but… My results:

    Name Count
    —- —–
    Write-Host 762
    New-Object 362
    Add-Member 59
    Get-Date 57
    Start-Sleep 38
    Read-Host 31
    ForEach-Object 28
    Remove-Variable 26
    Test-Path 25
    Get-WmiObject 20

Leave a Reply