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: Get–Service (“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
1 2 3 4 5 6 7 8 9 10 11 |
# Bad (Delete is not an approved verb) function Delete-Log { ... } # Good (Remove is an approved verb) function Remove-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).
Import-Module -Name sqlps -DisableNameChecking