Powershell Best Practice #7: Use approved verb (not unapproved verb)

By | June 3, 2015

Best Practice: It is recommended to use approved verb for cmdlet, do not use unapproved verb.

Explanation:

PowerShell cmdlets use the syntax Verb-Noun.
Example: GetService (“Get” is the verb, “Service” is the noun).

By following the syntax convention Verb-Noun we can immediately know what is the purpose of the cmdlet.

  • Get = Reads something
  • Set = Writes something
  • Test = Tests something

To get the list of approved verbs :  Get-Verb

get-verb-powershell

Note: When you import the SQL module, adding the “DisableNameChecking” parameter is used to suppress the warning about Encode-Sqlname and Decode-Sqlname. Indeed, “Encode” and “Decode” are not approved verbs (maybe they will be in the future but not until Powershell version 5.0.10105.0).

Import-Module -Name sqlps -DisableNameChecking


previous-buttonnext-button

Leave a Reply

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