List PowerShell verbs

As you may be aware, PowerShell cmdlets are supposed to be named with a standard verb. I usually suggest that scripters name scripts and functions also using a standard verb, although it is not required and I certainly bend the rules from time to time.  Hopefully by now you’re saying to yourself, “Show me the verbs!”

Here’s a PowerShell oneliner:

  1. $assembly = [System.Reflection.Assembly]::LoadWithPartialName("System.Management.Automation");$assembly.GetTypes() | where { $_.Name -match "Verbs" } | foreach {  $_.GetFields() | foreach { $_.Name }   } | sort

You can also view the official MSDN documentation.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Technorati Tags: , ,

Tags: , ,

3 Responses to “List PowerShell verbs”

  1. Hal Rottenberg Says:

    I refer back to the MSDN article a lot. I think it’s really important that people try to confirm to this when naming their scripts and functions, at least when they are meant to be shared.

    Here’s a tiny one-liner which lists all of the verbs in use in your session at that moment (which will likely be a smaller set than your script).

    gcm | group verb

  2. Jonathan Medd Says:

    There is a semi-colon missing:

    “…LoadWithPartialName(”System.Management.Automation”);$assembly.Ge

  3. Jeffery Hicks Says:

    I fixed the command. Thanks for the catch. Sometimes formatting screws things up and things get dropped or borked.

Leave a Reply


Entries (RSS) and Comments (RSS).