Consistent naming of PowerShell Cmdlets

PowerShell has some simple guidelines in naming cmdlets so consistence is achieved in cmdlet names.

Some quotes from this page describing Cmdlet Verb Names:

Windows PowerShell uses a verb-noun pair format for the names of cmdlets and their derived .NET classes. For example, the Get-Command cmdlet provided by Windows PowerShell is used to retrieve all commands registered in the Windows PowerShell shell. The verb part of the name identifies the action that the cmdlet performs. The noun part of the name identifies the entity on which the action is performed.

And

The following list provides guidelines to consider when creating a verb-noun pair:

  • When specifying the verb part of a name, it is strongly recommended to use one of the predefined verb names provided by Windows PowerShell. In doing so, you will ensure consistency between the cmdlets that you create, those provided by Windows PowerShell, and others.

  • To enforce consistency across cmdlets, do not use a synonym of an approved verb name.

  • Use only the present tense of a verb for a name. For example, use "get" instead of "getting".

  • Use a simple, singular noun in cmdlet naming. For example, use "Get-Record" instead of "Get-Records".

I wish I knew about this convention before writing loads of PowerShell code...

3 Comments

Comments have been disabled for this content.