Powershell Best Practice #6: Use singular noun (not plural noun)

By | May 22, 2015

Best Practice: It is recommended to use an english singular noun for cmdlet, do not use plural noun.

Explanation: PowerShell cmdlets use the syntax Verb-Noun, it is useful for users to read, use and discover cmdlets, for example:

  • Add-Member
  • Clear-Item
  • Compare-Object
  • Get-ADUser
  • Import-Module
  • Move-ADObject

You should choose an english noun (instead of spanish, french, german, etc.).

Be sure to not pick up a noun already used by a native cmdlet, use the parameter -Noun to check.

get-command-noun

(In my example I used “Get-Service” because it is more self-explanatory, but a cmdlet Get-Service already exist).

If you think the noun you choose could conflict with a native cmdlet, you should use a prefix (ex: Get-MyService instead of Get-Service, Get-ADUser, Get-AzureDisk, etc.).


previous-buttonnext-button

One thought on “Powershell Best Practice #6: Use singular noun (not plural noun)

  1. Pingback: Powershell Best Practice #5: Avoid the “Green Code” (not excessive and useless comments) | Powershell Guru

Leave a Reply

Your email address will not be published. Required fields are marked *