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, it is useful for users to read, use and discover cmdlets.

It is very useful to respect the Verb-Noun syntax because we can know what the cmdlet does without the need to check the source code.
The verb “Get” means that this cmdlet is Read-Only, the verb “Set” means that this cmdlet will write; etc.

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 *