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

Best Practice: It is recommended to use approved verbfor 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

PowerShell

1

2

3

4

5

6

7

8

9

10

11

# Bad (Delete is not an approved verb)

functionDelete-Log

{

...

}

# Good (Remove is an approved verb)

functionRemove-Log

{

...

}

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).