Functions are self-defined cmdlets, so function names should adhere to the same strict conventions. While you are free to name your functions any way you like, it is best practice to use the very same Verb-Noun syntax used by cmdlets – at least for functions that are publicly exposed.
Using Verb-Noun Syntax
A function name should start with an approved verb. Do not use any verb. Instead, stick to the verbs found in the list provided by Get-Verb:
Use one of the officially approved verbs
So instead of naming your function "Create-Account", choose "New-Account".
To quickly check whether a verb is really an approved verb, again use Get-Verb. If Get-Verb returns nothing, then you know the verb you tested is not approved:
|PS> Get–Verb create
PS> Get–Verb new
The verb "create" is not approved, the verb "new" is approved
If you do not use an approved verb, or abandon Verb-Noun-Syntax altogether, as soon as you distribute your functions as a PowerShell module, you will get a warning message whenever this module is imported:
|PS> Import–Module LabHelper
WARNING: The names of some imported commands from the module 'labhelper' include unapproved verbs tha
t might make them less discoverable. To find the commands with unapproved verbs, run the Import–Modul
e command again with the Verbose parameter. For a list of approved verbs, type Get–Verb.
This module contains functions or cmdlets with unapproved verbs
You can override this message by supplying the parameter -DisableNameChecking, but a much better approach is to make sure you are using approved verbs – approved verbs are an important measure to keep cmdlets and functions consistent and easily discoverable.
|PS> Import–Module LabHelper –DisableNameChecking
Using a Good Noun
Next, pick a good noun that describes the topic your function deals with. There is no "approved list" for nouns, so you can freely pick a noun. However, a good noun should be English and singular. Use singular nouns even if your function returns multiple objects.
So instead of "New-Accounts", name your function "New-Account".
Using Correct Casing
Function names are case-insensitive. Still, you should use upper case initials for both verb and noun. This makes function names more readible, and also when you autocomplete function names, the casing you choose is applied to autocompleted text.
Using a Company Prefix
There are chances that you are not the only one that picked a particular function name. To make sure there is no risk of conflicting function names, especially when you plan to distribute functions inside a PowerShell module, you or your company should early on pick a company-wide prefix, typically two or three characters.
So instead of naming your function "New-Account", when your company name is "My IT Services", a good prefix could be "MIS", and your function name should be "New-MISAccount". With a prefix, there is a much lower chance of conflicts, and also you can easily identify your own functions from other functions.