PowerShell Approved Verbs

PowerShell approved verbs is the best design decisions I like about PowerShell. Approved verbs allows you to use verb-noun naming rules while writing cmdlet or function in PowerShell.

PowerShell approved verbs is verb-noun style of format for using names for cmdlets, functions in PowerShell. Verb part of the name specify action that cmdlet or function performs and noun part specify identity on which action will be performed.

PowerShell approved verbs can be written as verb-noun pair in PowerShell. For example, Get-AdUser (Get – is the verb, AdUser – Noun) cmdlet in PowerShell get active directory users information.

Using naming convention Verb-Noun pair, anyone can understand the purpose of the cmdlet. For example,

  • Get – Retrieve information
  • Start – Start something
  • Remove – Remove or delete resource

In Windows PowerShell, there are approx. 98 approved verbs, you can get list of PowerShell approved verbs using Get-Verb cmdlet in PowerShell as below

Get-Verb

Get-Verb cmdlet in PowerShell gets approved verbs as below

PowerShell Approved Verbs
PowerShell Approved Verbs

Note: You can get approved verbs count using Get-Verb | Measure-Object , at the time of post write, approved verbs count is 98

Let’s understand about PowerShell approved verbs in details.

PowerShell Approved Verbs Naming Convention

PowerShell laid out verbs naming recommendation to name cmdlet or function in PowerShell. It ensure consistency between cmdlets or functions created by PowerShell or you or anyone who create it.

  • One should follow PowerShell approved verbs recommendation while creating it as given below
  • Use PowerShell approved verbs, you can get approved verbs list using Get-Verb
  • Use PowerShell predefined verb for action and noun to identify on which action will be performed.
  • Do not use approved verbs synonyms, for example, use write verb to write information, avoid using approved verb synonym as put or print.

PowerShell Approved Verbs Group

PowerShell has approved verbs for different group and specify action that apply to group.

Common Verbs

Common approved verbs contains predefined verbs to perform generic actions that can be apply to any cmdlet. For example, add, clear, close, get

To get common approved verbs in PowerShell, run below command

Get-Verb | Where Group -eq "Common" 

Communication Verbs

Communication verbs contains predefined verbs to perform action that apply to communication. For example, Connect, Disconnect, Send, Receive etc.

To get communication approved verbs in PowerShell, run below command

Get-Verb | Where Group -eq "Communications" 

Cool Tip: How to rename a computer in PowerShell!

Data Verbs

Data verbs contains predefined verbs to perform action that apply to data handling. For example, Convert, Save, Edit etc.

To get data approved verbs in PowerShell, run below command

Get-Verb | Where Group -eq "Data" 

Diagnostic Verbs

Diagnostic verbs contains predefined verbs to perform action that apply to diagnostics of resource. For example, Debug, Test, Repair etc.

To get diagnostic approved verbs in PowerShell, run below command

Get-Verb | Where Group -eq "Diagnostic" 

Lifecycle Verbs

Lifecycle verbs contains predefined verbs to perform action that apply to lifecycle of resource. For example, Approve, Disable, Enable etc.

To get lifecycle approved verbs in PowerShell, run below command

Get-Verb | Where Group -eq "LifeCycle" 

Security Verbs

Security verbs contains predefined verbs to perform action that apply to security of resource. For example, Block, Protect, Unblock etc.

To get security approved verbs in PowerShell, run below command

Get-Verb | Where Group -eq "Security" 

Other Verbs

Other verbs contains predefined verbs that do not cover under any of the above mentioned category. For example, use

Get-Verb | Where Group -eq "Other" 

Cool Tip: How to get computer information of remote computer in PowerShell!

Conclusion

I hope above article on PowerShell approved verbs helpful to you to write your cmdlet or function as per verb-noun format.

It is best practice to use approved verbs while writing cmdlet and avoid using approved verbs synonyms in PowerShell.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on ShellGeek home page.

Leave a Comment